Vue Slots Simplified

Sdílet
Vložit
  • čas přidán 7. 09. 2024
  • Slots are another way in Vue for a component to inject content into a child component. This does this using template code.
    In this video, we'll take a look at the basics of Vue slots, using scoped slots to pass data between components, named slots, and so much more.
    COMPANION ARTICLES
    general slot overview - learnvue.co/20...
    named slots - learnvue.co/20...
    scoped slots - learnvue.co/20...
    IMAGES USED
    placeholder image - i.stack.imgur....
    cute pic of me :) - learnvue.co/wp...
    FREE VUE 3 CHEATSHEET WITH ESSENTIAL CODE SNIPPETS
    learnvue.co/vu...
    follow me on twitter:
    / mattmaribojoc
    🚨 Like quick Vue lessons like these? Check out 800+ lessons over on Vue School - go.learnvue.co...

Komentáře • 65

  • @LesCarbonaro
    @LesCarbonaro Před 3 lety +26

    Excellent, well-rounded intro to a topic that always gives me grief. I like how you started your explanation from first principles and then built up to intermediate and advanced use of slots. Very smoothly executed! Thank you.

    • @LearnVue
      @LearnVue  Před 3 lety +4

      Glad to hear! Slots used to be difficult for me too, but they're such a cool feature of Vue once it finally clicks.

  • @TuTrinh211
    @TuTrinh211 Před 3 lety +9

    Great explanation. Slots and scoped slots are hard to explain but you did it with ease.

  • @jntaca
    @jntaca Před 3 lety +9

    Thanks ! !
    Very clear explanation of a pattern-breaking functionality.
    Your channel is excelent, you'll have a lot of subscribers in a short time.

  • @markg5986
    @markg5986 Před 2 lety +2

    This is the best explanation I've seen about vue slots. Thank you!

  • @mubafaw
    @mubafaw Před 2 lety +4

    Lets just say you're a legend! 😊 Thanks for putting me out of my mysery with Vue Slots! 😊

  • @cauesomenzi
    @cauesomenzi Před 3 lety +6

    Really clear explanation. Thank you so much!

  • @nevinkuser9892
    @nevinkuser9892 Před rokem

    Great work. I sent an image tag back to my component! Very exciting. For anyone trying to do this, make sure to add an id to whatever your passing in. It's the only way to style it.
    For example,
    #pic {
    width: 40vw;
    height: auto;
    }

  • @gmielli1281
    @gmielli1281 Před 3 lety +4

    WHAT A GEM 💎! Outstanding content, dude! Keep up the great work

  • @nswk_
    @nswk_ Před 2 lety +1

    I can't believe this is the video where scoped slots finally clicked for me! Thank you so much! #subscribed

  • @tomtomnichtnavi1431
    @tomtomnichtnavi1431 Před 2 lety

    4:35 very interesting to see that you can use the same slot multiple time. It makes total sence, but it wasn't apperant to me at first. Great video, slots have been a bit of a mistery to me, thanks.

  • @dylanwarrener5857
    @dylanwarrener5857 Před 2 lety +1

    Great video. Straight to the point and simple to follow. Also bonus for not sounding like a robot 😅

  • @svenyboyyt2304
    @svenyboyyt2304 Před rokem +1

    When you do videos like this, it would be cool if you linked the code you showed so you could check it out yourself. You could display the code like that, or maybe there's a way to open someone elses Vue playground, but I would generally appreciate being able to look through it at your own pace.

  • @JoschaWeiss
    @JoschaWeiss Před rokem

    thanks! was looking for scoped slots (without knowing the term) and found it!

  • @khoaphan9130
    @khoaphan9130 Před 2 lety +1

    Thanks very much, a straightforward and clear tutorial!

  • @kirankothandan5529
    @kirankothandan5529 Před 11 měsíci

    This is one of the finest and simple explanation ❤❤

  • @tomzhao8262
    @tomzhao8262 Před 3 lety +2

    Brief and effecient!

  • @2009massi
    @2009massi Před rokem

    Thankx for breaking it down.. great tutorial for beginners

  • @electroacoustico1384
    @electroacoustico1384 Před 2 lety

    I see a PH flag 🇵🇭 in the background bro, I like! lol GREAT CONTENTS!!

  • @bodiasokoliuk
    @bodiasokoliuk Před 2 měsíci

    thank you so much for explanation, wow

  • @deniznehlyadyuk4447
    @deniznehlyadyuk4447 Před 2 lety

    This tutorial saved my time thanks.

  • @mezianibelkacem650
    @mezianibelkacem650 Před 10 měsíci

    Very good explantation like it :D

  • @MatthewHinton
    @MatthewHinton Před 3 lety +1

    Really nice explanation.

  • @saturne2248
    @saturne2248 Před 2 lety +1

    Very interesting and helpful video thanks a lot

  •  Před 2 lety

    you are the best 🙌🔥

  • @slimyelow
    @slimyelow Před 2 lety

    Outstanding explanation. Bravo!

  • @standroads
    @standroads Před 2 lety

    Oh brother I really long time tried to understand scoped-slots and only you could give me right understanding...

  • @shlomiyahbes4882
    @shlomiyahbes4882 Před 11 měsíci

    Thanks!

  • @hamzaessaadi7569
    @hamzaessaadi7569 Před rokem

    thank youuu

  • @allaghi
    @allaghi Před 3 lety

    Thank you so much for your making this video.

  • @user-cg1tq6ki9o
    @user-cg1tq6ki9o Před 2 lety

    what a great explanation!

  • @watevakid
    @watevakid Před rokem

    The component "CaptionedContent" is capitalized, but in the template you use "captioned-content" - is this vue syntax? do you have a video about that? I'm sure its basic, but I'm just starting to look at vue and few videos. really like your teaching style/videos. thanks man!

    • @LearnVue
      @LearnVue  Před rokem

      yup! it's a common Vue practice to use kebab-case in the templates.

  • @sharonlau3963
    @sharonlau3963 Před 2 lety

    Thx!

  • @AnyFactor
    @AnyFactor Před 3 lety +1

    Great content!

  • @anantawijaya1594
    @anantawijaya1594 Před rokem

    great

  • @devdevil3087
    @devdevil3087 Před 2 lety

    We use slots for template code and if we don't allow template code we use properties?

  • @_q1b_
    @_q1b_ Před 3 lety +1

    Hey I am enjoying your videos can you make one video on provide and inject
    Please.

    • @LearnVue
      @LearnVue  Před 3 lety

      definitely! great suggestion

  • @thewiscokid81
    @thewiscokid81 Před 3 lety

    Keep up the good work 😸

  • @ThaRealIansanity
    @ThaRealIansanity Před rokem

    One thing confuses me. Why would I want to define data in the child, access it in the parent, and then pass it back into the child via the slot? I'm googling but not finding any examples where it doesn't make more sense to just keep the data in the parent and pass it to the child. I guess if the child makes an API call or something that changes the data and I want my parent component to modify the data based on some condition of what it received from the child before passing it back in? Just trying to make sense of it.

    • @AnisD756
      @AnisD756 Před rokem

      Let's say conditional rendering for example, or passing values to multiples component..Or side effect in the parent component :

  • @jacky8595125
    @jacky8595125 Před 2 lety

    thks

  • @jamols09
    @jamols09 Před 3 lety +1

    Hello there, I wanted to make a global component (not sure if this is right term). Similar to like a dialogbox, notification or simple modal.
    Scenario: I have a modal for registration. Message: "A message is sent to your email for verification". Button: "Re-send email"
    With `Message` part its easy since I can just pass the data however I am more concerned with the `Button's` functionality the for resending email. Is this gonna work with slot or prop ?

    • @LearnVue
      @LearnVue  Před 3 lety

      if you're making a separate component, you can have the button functionality inside that global modal component and handle resending the email there!

  • @binoysarker903
    @binoysarker903 Před 3 lety

    hello, my problem is that when i refresh the page the slot content data inside the loop is not rendering.

  • @sopheakphat1634
    @sopheakphat1634 Před 2 lety

    🥰👍

  • @butbutmybutt
    @butbutmybutt Před 2 lety

    after overriding a slot of a child can we also render the slots original content?

  • @AstroSardaukar
    @AstroSardaukar Před rokem

    Your picture returns a 404 error.
    Thanks for the tutorial.

  • @nested9301
    @nested9301 Před rokem

    vue needs to stop with this new features i'm confusing so much to learn bro