【发布时间】:2019-07-03 07:25:44
【问题描述】:
我正在尝试使用包含提前不知道其类型的组件的模板来填充 NativeScript-Vue ListView。例如,此代码不起作用,因为 NativeScript 没有“组件”元素,但这表明我正在尝试完成:
<ListView for="component in components">
<v-template>
<component :is="component" />
</v-template>
</ListView>
computed: {
components () {
return ['Label', 'Button'];
}
}
是的,我知道你可以在 v-template 中使用 if="",但在这种情况下,我不知道需要在 ListView 中加载哪些组件。在我的例子中,我在插件中加载全局组件,这些组件将在 ListView 中被引用。
【问题讨论】:
标签: vue.js nativescript nativescript-vue