<div id="example"> <parent></parent></div><script type="text/javascript"> // 局部注冊(cè) var Child = Vue.extend({ template: '<div>Child</div>' }); // 為什么 Child 不顯示? var Parent = Vue.extend({ template: `<div>Parent</div>`, components: { // child 只能用在父組件模版內(nèi) 'child': Child } }); var vm2 = new Vue({ el: '#example', components: { 'parent': Parent } });</script>上面代碼,不知道什么原因,為什么 child 組件中 內(nèi)容不顯示?官方的例子不太理解。求大神解答?
Vue.js 組件的局部注冊(cè),求解?
隔江千里
2018-08-09 10:10:47