mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-11-03 10:02:14 +08:00
feat(vue-components): page-fragment-container编辑器中不去除内部组件id,不然会导致无法从app中获取dsl
This commit is contained in:
parent
bf9fad18b6
commit
34bc223f02
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"name": "@tmagic/vue-page-fragment-container",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
|
||||
@ -14,14 +14,7 @@
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, type PropType, provide } from 'vue-demi';
|
||||
|
||||
import {
|
||||
cloneDeep,
|
||||
type Id,
|
||||
type MComponent,
|
||||
NodeType,
|
||||
PAGE_FRAGMENT_CONTAINER_ID_KEY,
|
||||
traverseNode,
|
||||
} from '@tmagic/core';
|
||||
import { type Id, type MComponent, NodeType, PAGE_FRAGMENT_CONTAINER_ID_KEY } from '@tmagic/core';
|
||||
import { registerNodeHooks, useApp, useComponent, useDsl } from '@tmagic/vue-runtime-help';
|
||||
|
||||
export default defineComponent({
|
||||
@ -50,19 +43,15 @@ export default defineComponent({
|
||||
|
||||
const containerComponent = useComponent({ componentType: 'container', app });
|
||||
|
||||
if (!props.config.id) {
|
||||
throw new Error('page-fragment-container must have id');
|
||||
}
|
||||
|
||||
const { pageConfig: fragment } = useDsl(app, props.config.id);
|
||||
|
||||
const containerConfig = computed(() => {
|
||||
if (!fragment.value) return { items: [], id: '', type: NodeType.CONTAINER };
|
||||
|
||||
if (app?.platform === 'editor') {
|
||||
const fragmentConfigWithoutId = cloneDeep(fragment.value);
|
||||
traverseNode(fragmentConfigWithoutId, (node) => {
|
||||
node.id = '';
|
||||
});
|
||||
return fragmentConfigWithoutId;
|
||||
}
|
||||
|
||||
return fragment.value;
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user