mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-23 16:35:51 +08:00
fix(editor): runtimeUrl更新后需要重新设置runtime的dsl
This commit is contained in:
parent
01b7b58065
commit
d31a544a23
@ -129,7 +129,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
import { provide, watch } from 'vue';
|
||||
import { provide } from 'vue';
|
||||
|
||||
import type { MApp } from '@tmagic/core';
|
||||
|
||||
@ -211,22 +211,6 @@ const 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('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 stage = editorService.get('stage');
|
||||
if (stage) {
|
||||
@ -434,7 +454,7 @@ export const initServiceEvents = (
|
||||
delete value.dataSourceCondDeps;
|
||||
}
|
||||
|
||||
const handler = async () => {
|
||||
(async () => {
|
||||
const nodeId = editorService.get('node')?.id || props.defaultSelected;
|
||||
let node;
|
||||
if (nodeId) {
|
||||
@ -453,9 +473,7 @@ export const initServiceEvents = (
|
||||
if (toRaw(value) !== toRaw(preValue)) {
|
||||
emit('update:modelValue', value);
|
||||
}
|
||||
};
|
||||
|
||||
handler();
|
||||
})();
|
||||
};
|
||||
|
||||
// 新增节点,收集依赖
|
||||
|
Loading…
x
Reference in New Issue
Block a user