动态组件
https://cn.vuejs.org/v2/guide/components.html#%E5%8A%A8%E6%80%81%E7%BB%84%E4%BB%B6```html
<body>
<div id="app">
<div v-for="item in array" :key="
item.id">
<component v-if="item.component" :is="item.component"></component>
<span v-else>{{ item.content }}</span>
</div>
</div>
<script>
Vue.component("tab-home", {
template: "<div>Home component</div>"
});
Vue.component("tab-posts", {
template: "<div>Posts component</div>"
});
new Vue({
el: "#app",
data() {
return {
array: [
{ id: 1, content: "test" },
{ id: 2, component: "tab-home" },
{ id: 3, component: "tab-posts" }
]
};
}
});
</script>
</body>
```