- Vue.component('name',{template:'xxx'}),传入两个参数,组件名和一个模板对象
Vue.component('show',{template:'标题组件'})
- 全局定义,局部注册
const Child = {template:'标题组件'} new Vue({ ... , components:{ 'show':Child } })
通过components属性注册
Vue.component('show',{template:'标题组件'})
const Child = {template:'标题组件'} new Vue({ ... , components:{ 'show':Child } })
通过components属性注册