Vue v-model in child components and defineModel

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ส.ค. 2024
  • We look at a few ways to use Vue's v-model in your child components. This includes a manual implementation, using writable computed, using a composable in the VueUse library, and using defineModel which is currently experimental in Vue 3.3.
    GitHub Repo: github.com/drehimself/vue-vmo...
    RFC link: github.com/vuejs/rfcs/discuss...
    LINKS
    My courses: codewithdre.com
    Sign up for my newsletter: andremadarang.com/newsletter
    My website: andremadarang.com
    Twitter: / drehimself
    GitHub: github.com/drehimself
    CodePen: codepen.io/drehimself
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @drehimself
    @drehimself  7 หลายเดือนก่อน +3

    defineModel is now stable in Vue 3.4: blog.vuejs.org/posts/vue-3-4#definemodel-is-now-stable

  • @whatsupbudbud
    @whatsupbudbud 5 หลายเดือนก่อน +2

    Loved your structural approach from least to most abstract.

  • @claytonnighthawk7837
    @claytonnighthawk7837 3 หลายเดือนก่อน

    Thank you, this was a really helpful explanation!

  • @user-eh6sf2lg6e
    @user-eh6sf2lg6e ปีที่แล้ว +1

    So glad I found this video.
    I just started working with Vue after React and this topic was very confusing for me. Especially since the same thing can be done in different ways. Thanks!

  • @maxralph01
    @maxralph01 ปีที่แล้ว

    Wow !
    Been a while, Andre !
    Single-handedly, your e-commerce video series made me an intermediate Laravel developer.
    Returning to say "Thank you" !

  • @ivan4486
    @ivan4486 3 หลายเดือนก่อน

    This is so helpful! Thank you so much!

  • @N1mdae
    @N1mdae 9 หลายเดือนก่อน +1

    This video was very helpful, thanks

  • @isabelphillips451
    @isabelphillips451 หลายเดือนก่อน

    Thank you for this 🤗

  • @ulugbekatakhanov1431
    @ulugbekatakhanov1431 11 หลายเดือนก่อน

    the best explanation. Great.

  • @oketafred
    @oketafred ปีที่แล้ว

    Awesome content Andre

  • @aissa.bouguern
    @aissa.bouguern ปีที่แล้ว

    Great and informative video as usual!

  • @keno571
    @keno571 ปีที่แล้ว

    Thanks for the great video! Looking forward to more :)

  • @devmenezes
    @devmenezes ปีที่แล้ว

    Nice content, Andre.

  • @acerhigh09
    @acerhigh09 หลายเดือนก่อน

    defineEmits not needed when using defineModel, are still there in the defineModel example, but perhaps that implicitly meant

  • @johnnydriesen7575
    @johnnydriesen7575 ปีที่แล้ว

    Excellent Vid. Very well explained.
    Thanks for willing to share your knowledge, and taking your time to create this vid.
    Question to you.. R U a fan of TS ? And if I can ask ... Why (not) ?

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

      I've only used TypeScript at a very basic level, I haven't really used it for any major projects. I understand the benefits, and I think you'll only see them if you really decide to go all in. Vue 3.3 has made some considerable improvements to using TS within Vue, so maybe we'll see more Vue devs using it.
      Check out this talk by Tanner Linsley (author of popular React libraries) who outlines his journey from non-TS person, to all-in with TS: th-cam.com/video/O4IWJcafX8c/w-d-xo.html. I think this is how most TS users feel.

    • @johnnydriesen7575
      @johnnydriesen7575 ปีที่แล้ว

      @@drehimself Thank you for your reply ! Highly appreciated.

  • @codedjango
    @codedjango ปีที่แล้ว

    Thanks....followed your tutorial n works very well, however, in Vue DevTools, in the child component, it shows:
    event-listeners:
    update:model-value: not-declared
    Is it that Vue devtools is not ready for this "defineModel" macro? Please suggest

  • @EduardoDonato82
    @EduardoDonato82 10 หลายเดือนก่อน

    Hi, what vscode theme are you using?

  • @mikeywork6348
    @mikeywork6348 9 หลายเดือนก่อน

    Does this work if the modelValue is an object that contains arrays?

  • @munandisichali605
    @munandisichali605 ปีที่แล้ว

    Any full courses that will come from you?

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

      Possibly in the future, for now, just trying to get some steady content going here on YT.

  • @Skia_
    @Skia_ ปีที่แล้ว

    If you try to console log the name ref in the app component, the value will not update in the console when the input value changes.
    Can someone explain to me why? I am a React developer
    How can i make the name ref update in the script tag?
    Thanks in advance

    • @whatsupbudbud
      @whatsupbudbud 5 หลายเดือนก่อน

      Question is where in the App component lifecycle you're console.logging it. If you did it just in the script tag, that would be similar to doing once on mounted.