<div id="example"> <parent></parent></div><script type="text/javascript"> // 局部注册 var Child = Vue.extend({ template: '<div>Child</div>' }); // 为什么 Child 不显示? var Parent = Vue.extend({ template: `<div>Parent</div>`, components: { // child 只能用在父组件模版内 'child': Child } }); var vm2 = new Vue({ el: '#example', components: { 'parent': Parent } });</script>上面代码,不知道什么原因,为什么 child 组件中 内容不显示?官方的例子不太理解。求大神解答?
添加回答
举报
0/150
提交
取消