<father></father>
声明一个对象,对象里就是组件的内容
子组件
var sun={
template:`<p>我是儿子</p>`
}
父组件
var father={
template:`
<div>
<p>我是父亲</p>
<sun></sun>
</div>
`
//父级里注册子级
components:{
"sun":sun
}
}
app构造器里
components:{
"father":father
}
<father></father>
声明一个对象,对象里就是组件的内容
子组件
var sun={
template:`<p>我是儿子</p>`
}
父组件
var father={
template:`
<div>
<p>我是父亲</p>
<sun></sun>
</div>
`
//父级里注册子级
components:{
"sun":sun
}
}
app构造器里
components:{
"father":father
}