mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix(editor): 代码变化时,参数表单需要重新渲染
This commit is contained in:
parent
7bf59929b0
commit
3cd1ac1cc4
@ -33,7 +33,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="">
|
<script lang="ts" setup name="">
|
||||||
import { computed, inject, ref } from 'vue';
|
import { computed, inject, ref, watch } from 'vue';
|
||||||
import { Edit, View } from '@element-plus/icons-vue';
|
import { Edit, View } from '@element-plus/icons-vue';
|
||||||
import { isEmpty, map } from 'lodash-es';
|
import { isEmpty, map } from 'lodash-es';
|
||||||
|
|
||||||
@ -78,6 +78,15 @@ const getParamItemsConfig = (codeId?: Id): CodeParamStatement[] => {
|
|||||||
const codeDsl = computed(() => services?.codeBlockService.getCodeDsl());
|
const codeDsl = computed(() => services?.codeBlockService.getCodeDsl());
|
||||||
const paramsConfig = ref<CodeParamStatement[]>(getParamItemsConfig(props.model[props.name]));
|
const paramsConfig = ref<CodeParamStatement[]>(getParamItemsConfig(props.model[props.name]));
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.model[props.name],
|
||||||
|
(v, preV) => {
|
||||||
|
if (v !== preV) {
|
||||||
|
paramsConfig.value = getParamItemsConfig(v);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const selectConfig = {
|
const selectConfig = {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
text: '代码块',
|
text: '代码块',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user