const CompA = Vue.extend({
template: `
底层:
`,
props: ['count'],
methods:{
increase () {
this.count++
}
}
})
const CompB = Vue.extend({
template: `
中间层:
`,
props: ['count'],
components: {
compA: CompA
},
methods:{
increase () {
this.count++
}
}
})
const CompC = Vue.extend({
data () {
return {
count: 0
}
},
template: `
顶层:
`,
components: {
compB: CompB
},
methods:{
increase () {
this.count++
}
}
})
new Vue({
el: "#demo",
components: {
compC: CompC
},
template: ``
})