mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-24 00:40:05 +08:00
fix(editor): runtimeUrl更新后需要重新设置runtime的dsl
This commit is contained in:
parent
01b7b58065
commit
d31a544a23
@ -129,7 +129,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
import { provide, watch } from 'vue';
|
import { provide } from 'vue';
|
||||||
|
|
||||||
import type { MApp } from '@tmagic/core';
|
import type { MApp } from '@tmagic/core';
|
||||||
|
|
||||||
@ -211,22 +211,6 @@ const stageOptions: StageOptions = {
|
|||||||
|
|
||||||
stageOverlayService.set('stageOptions', stageOptions);
|
stageOverlayService.set('stageOptions', stageOptions);
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.runtimeUrl,
|
|
||||||
(url) => {
|
|
||||||
if (!url) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const stage = editorService.get('stage');
|
|
||||||
if (!stage) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
stage.reloadIframe(url);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
provide('services', services);
|
provide('services', services);
|
||||||
|
|
||||||
provide('codeOptions', props.codeOptions);
|
provide('codeOptions', props.codeOptions);
|
||||||
|
@ -347,6 +347,26 @@ export const initServiceEvents = (
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.runtimeUrl,
|
||||||
|
(url) => {
|
||||||
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stage = editorService.get('stage');
|
||||||
|
if (!stage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
stage.reloadIframe(url);
|
||||||
|
|
||||||
|
stage.renderer?.once('runtime-ready', (runtime) => {
|
||||||
|
runtime.updateRootConfig?.(cloneDeep(toRaw(editorService.get('root')))!);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const getStage = (): Promise<StageCore> => {
|
const getStage = (): Promise<StageCore> => {
|
||||||
const stage = editorService.get('stage');
|
const stage = editorService.get('stage');
|
||||||
if (stage) {
|
if (stage) {
|
||||||
@ -434,7 +454,7 @@ export const initServiceEvents = (
|
|||||||
delete value.dataSourceCondDeps;
|
delete value.dataSourceCondDeps;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handler = async () => {
|
(async () => {
|
||||||
const nodeId = editorService.get('node')?.id || props.defaultSelected;
|
const nodeId = editorService.get('node')?.id || props.defaultSelected;
|
||||||
let node;
|
let node;
|
||||||
if (nodeId) {
|
if (nodeId) {
|
||||||
@ -453,9 +473,7 @@ export const initServiceEvents = (
|
|||||||
if (toRaw(value) !== toRaw(preValue)) {
|
if (toRaw(value) !== toRaw(preValue)) {
|
||||||
emit('update:modelValue', value);
|
emit('update:modelValue', value);
|
||||||
}
|
}
|
||||||
};
|
})();
|
||||||
|
|
||||||
handler();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 新增节点,收集依赖
|
// 新增节点,收集依赖
|
||||||
|
Loading…
x
Reference in New Issue
Block a user