5 Easy Ways To Pass Info To Vue Components!

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 53

  • @rabbyhossain6150
    @rabbyhossain6150 4 ปีที่แล้ว +6

    With "vuex " I faced two problems : 1. Mutating state property directly and 2. while refreshing the page "vuex" state backs to its initial state. It will be great if you clear those concepts or show best practices.

  • @KostiaBazrov
    @KostiaBazrov 4 ปีที่แล้ว +3

    PARRENT => provide() {return { myText: this.otherProps}}
    Child => inject['myText']

    • @ProgramWithErik
      @ProgramWithErik  4 ปีที่แล้ว +1

      Kostia Bazrov-WORK thats a good one , I was going to show how you can make an observable object using Vues observable , but I ran out of time. That could work to with inject

  • @ponic12
    @ponic12 2 ปีที่แล้ว +2

    What about the event bus (emit)?

  • @blokche_dev
    @blokche_dev 4 ปีที่แล้ว +3

    Vuex may appear a bit cumbersome in some situtations.
    Event bus also may be a nice way to pass data across different components (with or without relations).

    • @ProgramWithErik
      @ProgramWithErik  4 ปีที่แล้ว

      blokche_dev that’s another good one !

    • @dcernach
      @dcernach 4 ปีที่แล้ว

      I couldn't agree more, just check this out: austincooper.dev/2019/08/09/vue-observable-state-store/

  • @asgharale6704
    @asgharale6704 3 ปีที่แล้ว +1

    hey tutorial was great but i have a api data and using it in a vue page ok and now i passing a part of it to vomponent and it work nicely but when i refreshing the page it wont send the data again can you guide me to make it to pass data even after page refreshing please?

  • @scryptum
    @scryptum 3 ปีที่แล้ว

    Inject method looks really useful. Thanks!

  • @oleksandr3275
    @oleksandr3275 4 ปีที่แล้ว +1

    Hi Erik !
    I am new in Vue js, and your tutorial is very helpful !
    Thanks

  • @alexeypochivalin7692
    @alexeypochivalin7692 4 ปีที่แล้ว

    Hi, thanks for video. But example with Vue.prototype don't work for me. In conole.log i have a vue is function and "Vue is a constructor and should be called with the `new` keyword". Can you help me, what could be the error ?

  • @Y2hlc3Rlcg
    @Y2hlc3Rlcg 4 ปีที่แล้ว

    more of this Erik. this is very helpful! developer from Philippines.

  • @yongpinbong441
    @yongpinbong441 3 ปีที่แล้ว

    Nuxt: What if the parent component is the default.vue from the layouts folder, would you still be able to send data from the default.vue to your components from either the page's folder or component's folder?

  • @christopher7540
    @christopher7540 4 ปีที่แล้ว +2

    such a great video. thank you erik .please make a video about how we can use vue with express and mongodb. i know it is very easy to use firebase for database with vue but mongo with vue is a little bit confusing for begginers like me. thank you in advance

  • @scryptum
    @scryptum 3 ปีที่แล้ว

    Could you make some videos about Vuex persistent Data and Cookies?

  • @kimhakkol7199
    @kimhakkol7199 3 ปีที่แล้ว

    Yes, my mind was blown while watching the video! Thank you so much! :)

  • @opereznet
    @opereznet 4 ปีที่แล้ว

    Hi Erik, I have a Nuxt-Vuetify app which only has the default and index layouts. I'm trying $refs method to make changes on default.vue. If I add a {{ message }} on default's toolbar (v-app-bar and v-toolbar-tile) and change it from index.vue works perfect but didn't work on default's footer (v-footer v-row v-col), can you help me out? By the way, I really learn from your videos, you have high level of knowledge and know how to explain. Thanks.

  • @timtitus7861
    @timtitus7861 4 ปีที่แล้ว

    Excellent tutorial buddy! Really enjoyed this

  • @osmelguarepo6523
    @osmelguarepo6523 3 ปีที่แล้ว

    use cases of using refs and prototype?

  • @matthewbeardsley7004
    @matthewbeardsley7004 4 ปีที่แล้ว +1

    Thanks for the overview Erik, I kinda wish there weren't so many ways, so that it is easier to follow convention

    • @ProgramWithErik
      @ProgramWithErik  4 ปีที่แล้ว

      Yeah, you are right. Just pick the easiest way for you

  • @nitinnanda1865
    @nitinnanda1865 4 ปีที่แล้ว

    do you have the git project where you have NOT made these changes already? I want to follow along the video but git project already has the changes so it makes no sense.

  • @hai6460
    @hai6460 4 ปีที่แล้ว +1

    anyone knows how to pass data between two components that aren't related. Thanks

    • @ProgramWithErik
      @ProgramWithErik  4 ปีที่แล้ว +1

      Then you'll need to use something like vuex

    • @hai6460
      @hai6460 4 ปีที่แล้ว

      @@ProgramWithErik Yeah thank you, i also found out i could use something called 'Bus event' it did pretty good job

  • @wind8x1
    @wind8x1 3 ปีที่แล้ว

    This is the best formula of passing data in different ways.

  • @rajikkali2381
    @rajikkali2381 3 ปีที่แล้ว

    $parent is golden. I've built a ton of Vue apps and never knew about that one.

  • @onnot701
    @onnot701 4 ปีที่แล้ว

    thx very informative video

  • @vibonacci
    @vibonacci 4 ปีที่แล้ว

    props + this.$parent is the fastest one for direct child / father exchange

    • @Same7ashY
      @Same7ashY 4 ปีที่แล้ว

      Right, but "this.$parent" is considered a bad practice, I think. Plus you're technically not "passing" the data, instead you're reaching out for the parent and getting that data.

  • @raihan.nismara
    @raihan.nismara 3 ปีที่แล้ว

    IT'S DOPE

  • @moldovandorin6187
    @moldovandorin6187 4 ปีที่แล้ว

    i tried for hours to make Vue.prototype work and it doesn't...it baffles me that in this tutorial it works...and I don't understand why in mine is not....damn

  • @ytmrdk
    @ytmrdk 4 ปีที่แล้ว +1

    How about Fire.$emit 😁, but thanks for this videos, excelent!

  • @phredlane9081
    @phredlane9081 2 ปีที่แล้ว

    Why not use events? That's the first thing that came to mind.

  • @HoracioDegiorgi
    @HoracioDegiorgi 4 ปีที่แล้ว

    To favs. Thanks

  • @maskman4821
    @maskman4821 4 ปีที่แล้ว +1

    the sixth way is using bus !

    • @ProgramWithErik
      @ProgramWithErik  4 ปีที่แล้ว +1

      Yes, I thought about showing that, maybe next video

  • @dasten123
    @dasten123 4 ปีที่แล้ว

    Parent: window.message = 'thisisaverygoodidea';
    Child: setInterval(() => this.message = window.message, 1337);

  • @karnjeet1
    @karnjeet1 3 ปีที่แล้ว

    How to call child method from parent

    • @karnjeet1
      @karnjeet1 3 ปีที่แล้ว

      We have index page all child page loaded inside of index page using routing.
      We require to consume method of child page from index

  • @Waelio
    @Waelio 2 ปีที่แล้ว

    What about $emit ?? 😲😮😱😱😳😬

  • @jotasenator
    @jotasenator 3 ปีที่แล้ว

    I was here hoping to find some $event in here..?!

  • @peterugah9295
    @peterugah9295 4 ปีที่แล้ว

    Second

  • @taranrishith
    @taranrishith 4 ปีที่แล้ว

    First!

  • @_nom_
    @_nom_ 3 ปีที่แล้ว +1

    Vuex has a terrible API.

  • @jamshediqbal7936
    @jamshediqbal7936 4 ปีที่แล้ว

    I am a React developer. After watching this video, it reminds me of Angularjs 1.x days..

  • @dev9vil287
    @dev9vil287 2 ปีที่แล้ว

    Your intro should be smaller