- Vue.component('name',{template:'xxx'}),传入两个参数,组件名和一个模板对象
Vue.component('show',{template:'<h1>标题组件</h1>'}) - 全局定义,局部注册
const Child = {template:'<h1>标题组件</h1>'} new Vue({ ... , components:{ 'show':Child } })通过components属性注册
2018-01-19 04:28:22
浏览 2032
Vue.component('show',{template:'<h1>标题组件</h1>'})const Child = {template:'<h1>标题组件</h1>'}
new Vue({
...
,
components:{
'show':Child
}
})
通过components属性注册
随时随地看视频慕课网APP
相关课程