[Vuejs]-VueJs Runtime components

0👍

There are two ways you can use the component in your template the way you want. First, you can register the component globally.

import SomeComponent from "./SomeComponent.vue"

Vue.component("some-component", SomeComponent)

You could then use this in a template as <some-component></some-component>.

Second, you can locally register components.

import SomeComponent from "./SomeComponent.vue"

new Vue({
    components:{
        SomeComponent
    }
})

Which, again, you could use in the template as <some-component></some-component>, but only in the root Vue. If you wanted to use it in other components you would need to import it and add it to the local components of the component you want to use it in.

👤Bert

Leave a comment