| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <template>
- <!-- 在下方添加自定义组件 -->
- <!-- 业务代码开始 -->
- <template v-if="node.type === 'test'">
- <text>这是一个测试节点</text>
- </template>
- <!-- 业务代码结束 -->
- <template v-else>
- <slot :node="node" :context="xContext" />
- <!-- #ifdef MP -->
- <!-- <text style="color: red;">自定义渲染插槽在MP环境下不支持,当前节点类型:{{props.node.type}}</text> -->
- <!-- #endif -->
- <!-- #ifndef MP -->
- <!-- <slot :node="node" :context="xContext" /> -->
- <!-- #endif -->
- </template>
- </template>
- <script setup lang="ts">
- import { inject, ref, type PropType } from 'vue';
- import type { DynamicXNode, DynamicXNodeContext } from '@/components/dynamic/DynamicX';
- const props = defineProps({
- node: {
- type: Object as PropType<DynamicXNode>,
- default: () => ({})
- },
- mergedProps: {
- type: Object as PropType<Record<string, any>>,
- default: () => ({})
- },
- });
- const emit = defineEmits([]);
- const xContext = inject<DynamicXNodeContext>('xContext');
-
- defineOptions({
- options: {
- virtualHost: true,
- }
- })
- </script>
|