Re:Vue 3.0 Updates [slides]
by armaxt on Saturday November 17, 2018 @07:52AM
(#18475342)
How about the ability to create multiple components in the same .vue file? for instance I need to define a sub-component that will be used only inside my component, this is easy in React but with Vue I have to create another file to define this sub-component, this makes the project management becomes harder as the project grows
[ Parent
| on HN ]
That is one of the few aspects I prefer in React over Vue.
But you can indeed create small inline components in .vue files.
There are different approaches: https://codewithhugo.com/writing-multiple-vue-components-in-...
This is totally possible. You can create a sub component, register and use it in the same file as the parent component.
Though not really recommended you can even do this:
...
components: {
"inline": {
template: `
<h1>My inline subcomponent</h1>
`
}
}
...
Re:Vue 3.0 Updates [slides]
by deltron3030 on Saturday November 17, 2018 @05:36PM
(#18477723)
>How about the ability to create multiple components in the same .vue file?
No problem: https://www.youtube.com/watch?v=l3GHggI3_z8
As you can see, the're quite a few nested components in a single .vue file.