Skip to content

Commit

Permalink
fix: 修复setJson丢失响应性问题
Browse files Browse the repository at this point in the history
  • Loading branch information
付成伟 authored and 付成伟 committed Jul 15, 2021
1 parent da0edc8 commit 905d795
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-form-create",
"description": "一个基于Vue3.0 + TS 的表单设计器",
"version": "1.2.2",
"version": "1.2.3",
"main": "dist/formCreate.umd.min.js",
"types": "src/index.d.ts",
"homepage": "https://github.com/fuchengwei/vue-form-create",
Expand Down
17 changes: 4 additions & 13 deletions src/core/antd/AntdDesignForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<script lang="ts">
import { defineComponent, reactive, PropType, toRefs, watchEffect } from 'vue'
import { message } from 'ant-design-vue'
import { defaultsDeep } from 'lodash'
import { merge } from 'lodash'
import CodeEditor from '@/components/CodeEditor.vue'
import ComponentGroup from '@/components/ComponentGroup.vue'
import AntdHeader from './AntdHeader.vue'
Expand Down Expand Up @@ -247,13 +247,7 @@ export default defineComponent({
const handleUploadJson = () => {
try {
state.widgetForm.list = []
defaultsDeep(state.widgetForm, JSON.parse(state.jsonEg))
if (state.widgetForm.list) {
state.widgetFormSelect = state.widgetForm.list[0]
}
setJson(JSON.parse(state.jsonEg))
state.uploadJsonVisible = false
message.success('上传成功')
} catch (error) {
Expand Down Expand Up @@ -297,10 +291,7 @@ export default defineComponent({
const handleClearable = () => {
state.widgetForm.list = []
defaultsDeep(
state.widgetForm,
JSON.parse(JSON.stringify(antd.widgetForm))
)
merge(state.widgetForm, JSON.parse(JSON.stringify(antd.widgetForm)))
state.widgetFormSelect = null
}
Expand All @@ -310,7 +301,7 @@ export default defineComponent({
const setJson = (json: WidgetForm) => {
state.widgetForm.list = []
defaultsDeep(state.widgetForm, json)
merge(state.widgetForm, json)
if (json.list.length) {
state.widgetFormSelect = json.list[0]
}
Expand Down

0 comments on commit 905d795

Please sign in to comment.