Write Reusable Code with Vue DYNAMIC COMPONENTS

  Рет қаралды 31,728

LearnVue

LearnVue

Күн бұрын

Пікірлер: 33
@ericjunior105
@ericjunior105 2 жыл бұрын
I don't know how to say this but your account is a life saver. Short, precise and useful
@LearnVue
@LearnVue 2 жыл бұрын
❤️
@astrosoup
@astrosoup 3 жыл бұрын
These short videos are incredibly helpful to a learner like myself. Thank you for making them!
@LearnVue
@LearnVue 3 жыл бұрын
glad you like them!
@biliyonnet
@biliyonnet 2 жыл бұрын
I used it to convert markdown to vue. First I found markdown directives in document and then convert them to vue component like "*italic content*" to "italic content and then I was have a valid vue template string, so created an object with it and gived it to the and then created and feed the dynamic component with that md components like italic and others.
@gabrielmachado5708
@gabrielmachado5708 2 жыл бұрын
You can also pass the component as a variable, and not necessarily need to have the component registered
@mjkodonk
@mjkodonk 3 жыл бұрын
Save my day. Thank you
@Revadike
@Revadike 9 ай бұрын
Often components have unique attributes, so then it's usually better to just use v-if
@alexwakeup7098
@alexwakeup7098 Ай бұрын
You can use provide/inject to pass those attributes without the need of defining them
@前端小智
@前端小智 3 жыл бұрын
Hi, can I translate the article from Learnnvue website into Chinese and share it to more developers? I will write the original author and the address of the article.
@thomaspotterdotexe
@thomaspotterdotexe Жыл бұрын
But what about reusable the component from vue component like the vuetify form input or ant design vue table select input form?
@gurkengerd9981
@gurkengerd9981 Жыл бұрын
Isn't that pseudo-dynamic since at implementation time you need to know which types of component can be passed in? I am comming from a Jetpack Compose background and in many components with have a simple content parameter, in which we can pass ANY component we want and it gets rendered flawless.
@_q1b_
@_q1b_ 3 жыл бұрын
Can you make a video on render function
@nyambe
@nyambe 2 жыл бұрын
This did NOT work with script setup, component :is= wanted the component itself, the name alone was not enough. Is that because they are not being exported?
@ColinRichardson
@ColinRichardson 2 жыл бұрын
did you do: `import ComponentA from './ComponentA.vue'; or `const ComponentA = import('./ComponentA.vue')` or better yet `const ComponentA = defineDynamicImport(() => import('./ComponentA.vue'));`
@nyambe
@nyambe 2 жыл бұрын
@@ColinRichardson I used DynamicImport . I was using script setup. Regular import as shown, did not work as expected.
@ColinRichardson
@ColinRichardson 2 жыл бұрын
@@nyambe should work then.. unless you accidently did `import './ComponentA.vue'` Because what you do then, is import the component with no name associated with it.
@nyambe
@nyambe 2 жыл бұрын
@@ColinRichardson DynamicImport did work, regular import did not. Not sure why. With script setup, there is some doc on that. Google it
@RobertWildling
@RobertWildling 2 жыл бұрын
@@ColinRichardson What about the `comp` variable? How is that one supposed to be initialised I Vue 3? (I think a separate video about DynamicComponents in Vue 3 would be very helpful.) I needed to do this to make it work (but is it the best way?): import { shallowRef, defineAsyncComponent } from 'vue' const ComponentA = defineAsyncComponent(() => import('../components/componentA.vue')); const ComponentB = defineAsyncComponent(() => import('../components/componentB.vue')); const comp = shallowRef(ComponentA)
@fadlaichsan4924
@fadlaichsan4924 3 жыл бұрын
Wow, that's cool! Can you make animate scrolling page with vue js?
@achuagbama2699
@achuagbama2699 2 жыл бұрын
I recommend Netninja tutorials on vue animations with Gsap
@markusandressen2171
@markusandressen2171 3 жыл бұрын
Hey LearnVue, thank you for insights. Wanted to ask, could you make a tutorial on how to do SSG (Static site generation) with Vue 3? Tried a few solutions such as vite-ssg and vite-plugin-ssr with no success due to lack of experience.
@LearnVue
@LearnVue 3 жыл бұрын
definitely will be looking into this topic for future videos. i recommend checking out vitepress or gridsome in the meantime though!
@augischadiegils.5109
@augischadiegils.5109 2 жыл бұрын
thanks
@habalgarmin
@habalgarmin 2 жыл бұрын
I don`t like dynamic components because it's hard to use it with TypeScript.
@thomaspotterdotexe
@thomaspotterdotexe 2 жыл бұрын
I'm new in Vue and the only problem I have is how to pass data to the targeted components while every components have different props :(
@LearnVue
@LearnVue 2 жыл бұрын
Hey there! One solution would be to accept a single object as a prop for each of the dynamic components, and then you can destructure that object on a per-component basis depending on which data it needs. I'd recommend setting up custom validators for that prop though!
@codybass8873
@codybass8873 3 ай бұрын
👍
@abdianrizkyramadan1535
@abdianrizkyramadan1535 3 жыл бұрын
Cool
@前端小智
@前端小智 3 жыл бұрын
good
Reusable Form Components with Vue 3
14:18
Vue Mastery
Рет қаралды 54 М.
Props and Emitters in Vue 3 (FULL TUTORIAL)
14:53
VueReference
Рет қаралды 17 М.
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47
BeatboxJCOP
Рет қаралды 33 МЛН
How Strong is Tin Foil? 💪
00:25
Brianna
Рет қаралды 47 МЛН
Better Rendering Performance with Virtual Lists
5:59
LearnVue
Рет қаралды 35 М.
Easy Loading Screens with Vue Suspense Components
4:29
LearnVue
Рет қаралды 34 М.
Reusable Form Input Components With Vue 3
6:04
John Komarnicki
Рет қаралды 21 М.
Dynamic Components in Vue
14:30
Alexander Lichter
Рет қаралды 8 М.
Avoid losing Reactivity in your Vue Application
10:32
Alexander Lichter
Рет қаралды 8 М.
Vue Slots Simplified
7:25
LearnVue
Рет қаралды 56 М.
Vue 3 фундаментальный курс от А до Я
3:01:26