fix(editor): 代码变化时,参数表单需要重新渲染

This commit is contained in:
roymondchen 2023-09-07 19:01:01 +08:00
parent 7bf59929b0
commit 3cd1ac1cc4

View File

@ -33,7 +33,7 @@
</template>
<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 { isEmpty, map } from 'lodash-es';
@ -78,6 +78,15 @@ const getParamItemsConfig = (codeId?: Id): CodeParamStatement[] => {
const codeDsl = computed(() => services?.codeBlockService.getCodeDsl());
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 = {
type: 'select',
text: '代码块',