From b06f6a316b6a8293bb8aba6bfff33336b66c032a Mon Sep 17 00:00:00 2001 From: ahaos <8406649+lhailgl@user.noreply.gitee.com> Date: 星期三, 13 十二月 2023 09:01:52 +0800 Subject: [PATCH] !64 版本升级 * Merge branch 'dev' of gitee.com:JavaLionLi/plus-ui into ts * 升级依赖 * !61 fix: 删除重复环境变量ElUploadInstance * fix: 删除重复环境变量ElUploadInstance --- src/components/BuildCode/index.vue | 73 +++++++++++++++++------------------- 1 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/components/BuildCode/index.vue b/src/components/BuildCode/index.vue index b23665c..0b8e3f4 100644 --- a/src/components/BuildCode/index.vue +++ b/src/components/BuildCode/index.vue @@ -1,53 +1,50 @@ -<!-- 浠g爜鏋勫缓 --> -<script setup lang="ts"> - -const props = defineProps({ - showBtn: { - type: Boolean, - default: false - }, - formJson: { - type: Object, - default: undefined - } -}) -const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const buildRef = ref(); -const emits = defineEmits(['reJson', 'saveDesign']); - - - -//鑾峰彇琛ㄥ崟json -const getJson = () => { - const formJson = JSON.stringify(buildRef.value.getFormJson()) - const fieldJson = JSON.stringify(buildRef.value.getFieldWidgets()) - let data = { - formJson, fieldJson - } - emits("saveDesign", data) -} - -onMounted(() => { - if (props.formJson) { - buildRef.value.setFormJson(props.formJson) - } -}) -</script> - <template> + <!-- 浠g爜鏋勫缓 --> <div> <v-form-designer - class="build" ref="buildRef" + class="build" :designer-config="{ importJsonButton: true, exportJsonButton: true, exportCodeButton: true, generateSFCButton: true, formTemplates: true }" > - <template #customToolButtons v-if="showBtn"> + <template v-if="showBtn" #customToolButtons> <el-button link type="primary" icon="Select" @click="getJson">淇濆瓨</el-button> </template> </v-form-designer> </div> </template> +<script setup lang="ts"> +interface Props { + showBtn: boolean; + formJson: any; +} + +const props = withDefaults(defineProps<Props>(), { + showBtn: true, + formJson: '' +}); + +const buildRef = ref(); +const emits = defineEmits(['reJson', 'saveDesign']); + +//鑾峰彇琛ㄥ崟json +const getJson = () => { + const formJson = JSON.stringify(buildRef.value.getFormJson()); + const fieldJson = JSON.stringify(buildRef.value.getFieldWidgets()); + let data = { + formJson, + fieldJson + }; + emits('saveDesign', data); +}; + +onMounted(() => { + if (props.formJson) { + buildRef.value.setFormJson(props.formJson); + } +}); +</script> + <style lang="scss"> .build { margin: 0 !important; -- Gitblit v1.9.3