萧十郎
我是写在父组件中的:Vue.component('mycontent', {
props: ['content'], data() { return {
coms: [],
}
},
render: function(h) { this.coms = [];
for(var i = 0; i < this.content.length; i++) {
this.coms.push(h(this.content[i], {}))
} return h('div', {},
this.coms)
},
});调用的时候
<mycontent v-bind:content="content"></mycontent>那么父组件中的content变化时,就会动态加载组件了