如何在 nativescript-vue 弹窗中使用 vue 组件?
How to use vue components in nativescript-vue popups?
我在某些根组件中打开弹出窗口是这样的:
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
中组件对象中的括号错误。组件是一个对象,因此使用大括号而不是方括号。
因此,正确的脚本部分看起来像 parentt.vue
:
<script>
import child from "./child.vue";
export default {
components: {
child
},
};
</script>
以获得详细信息
我在某些根组件中打开弹出窗口是这样的:
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
中组件对象中的括号错误。组件是一个对象,因此使用大括号而不是方括号。
因此,正确的脚本部分看起来像 parentt.vue
:
<script>
import child from "./child.vue";
export default {
components: {
child
},
};
</script>
以获得详细信息