SoFunction
Updated on 2025-04-05

Vue-component global registration instance

The global registration of a component must be taken care of before instantiating the object.

("mytest",
{
 template:'<li>{{name}}</li>',
 props:['name']


})

new Vue({
//...
})

Local registration can only be used in the parent template

<div  >
<mytest v-for='li in list' v-bind:name='li'>


</mytest>

</div>


var vm=new Vue({
 el:'#clear',
 data:{
  list:[1,2,3]


 },
 components:{
  'mytest':{
   template:'<li>{{name}}</li>',
   props:['name']

 }

 }
})

The above example of Vue-component global registration is all the content I share with you. I hope you can give you a reference and I hope you can support me more.