我像这样在一些根组件中打开弹出窗口:
import parentt from "./parentt.vue";
.
.
.
this.$showModal(parentt, {
fullscreen: true,
});
这是parentt.vue
的内容:
<template>
<StackLayout>
<label text="parent" />
<!-- <child /> -->
</StackLayout>
</template>
<script>
import child from "./child.vue";
export default {
components: [child],
};
</script>
<style scoped>
</style>
这是child.vue
的内容:
<template>
<StackLayout>
<label text="child" />
</StackLayout>
</template>
<script>
export default {};
</script>
<style scoped></style>
用<child />
注释掉我得到一个带有文本父级的弹出窗口。
与 <child />
在那里我得到一个白屏。
我在我的代码的不同地方使用了很多组件,它只是在弹出窗口中不起作用。
最佳答案
您在 parentt.vue
中的组件对象中有错误的括号。 Components 是一个对象,因此使用大括号代替方括号。
因此,正确的脚本部分在 parentt.vue
中如下所示:
<script>
import child from "./child.vue";
export default {
components: {
child
},
};
</script>
我推荐 official vue documentation 以获得详细信息
关于javascript - 如何在 nativescript-vue 弹窗中使用 vue 组件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57144351/