Write Reusable Code with Vue DYNAMIC COMPONENTS

  Рет қаралды 32,259

LearnVue

LearnVue

Күн бұрын

Пікірлер
@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!
@ericjunior105
@ericjunior105 3 жыл бұрын
I don't know how to say this but your account is a life saver. Short, precise and useful
@LearnVue
@LearnVue 3 жыл бұрын
❤️
@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.
@thomaspotterdotexe
@thomaspotterdotexe Жыл бұрын
But what about reusable the component from vue component like the vuetify form input or ant design vue table select input form?
@前端小智
@前端小智 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.
@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.
@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)
@Revadike
@Revadike 11 ай бұрын
Often components have unique attributes, so then it's usually better to just use v-if
@alexwakeup7098
@alexwakeup7098 3 ай бұрын
You can use provide/inject to pass those attributes without the need of defining them
@mjkodonk
@mjkodonk 3 жыл бұрын
Save my day. Thank you
@_q1b_
@_q1b_ 3 жыл бұрын
Can you make a video on render function
@gabrielmachado5708
@gabrielmachado5708 2 жыл бұрын
You can also pass the component as a variable, and not necessarily need to have the component registered
@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!
@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
@thomaspotterdotexe
@thomaspotterdotexe 3 жыл бұрын
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 3 жыл бұрын
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!
@habalgarmin
@habalgarmin 2 жыл бұрын
I don`t like dynamic components because it's hard to use it with TypeScript.
@augischadiegils.5109
@augischadiegils.5109 2 жыл бұрын
thanks
@codybass8873
@codybass8873 5 ай бұрын
👍
@前端小智
@前端小智 3 жыл бұрын
good
@abdianrizkyramadan1535
@abdianrizkyramadan1535 3 жыл бұрын
Cool
Vue Slots Simplified
7:25
LearnVue
Рет қаралды 57 М.
Animating Vue Router Transitions in Vue 3
12:08
LearnVue
Рет қаралды 53 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
How Vue Keep Alive Can Improve Your App
6:45
LearnVue
Рет қаралды 30 М.
Better Rendering Performance with Virtual Lists
5:59
LearnVue
Рет қаралды 36 М.
Use Vue Teleport to Make Modals and Popups
4:55
LearnVue
Рет қаралды 32 М.
Building a Reusable Tabs Component with Vue Slots
8:21
LearnVue
Рет қаралды 33 М.
Vue.js API Client Layer Explained in 4 minutes
3:54
Neuronfire
Рет қаралды 507
3 Ways to Persist Pinia State
4:54
LearnVue
Рет қаралды 55 М.
7 Ways to write better V-FOR LOOPS
4:15
LearnVue
Рет қаралды 22 М.
5 Ways to Fetch Data from an API in Vue 3 Composition API
6:28
Justin Brooks
Рет қаралды 76 М.
Pinia Simplified
4:28
LearnVue
Рет қаралды 126 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН