Skip to content

Commit 659bfdd

Browse files
jiejie-colorljw笔记本
and
ljw笔记本
authored
feat: 不修改原schema (#239)
Co-authored-by: ljw笔记本 <jiejiecolor@gmail.com>
1 parent 4f2e311 commit 659bfdd

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/components/core/schema-form/src/schema-form-item.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</template>
5555

5656
<script setup lang="tsx">
57-
import { computed, unref, toRefs, isVNode, watch, nextTick } from 'vue';
57+
import { computed, unref, toRefs, isVNode, watch, nextTick, ref } from 'vue';
5858
import { cloneDeep, debounce, isEqual } from 'lodash-es';
5959
import { Form, Col, Spin, Divider } from 'ant-design-vue';
6060
import { useItemLabelWidth } from './hooks/useLabelWidth';
@@ -83,7 +83,21 @@
8383
8484
const { t } = useI18n();
8585
86-
const { schema } = toRefs(props);
86+
// const { schema } = toRefs(props);
87+
function deepCopy(obj) {
88+
if (typeof obj !== 'object' || obj === null) {
89+
return obj;
90+
}
91+
92+
let copy = {};
93+
for (let key in obj) {
94+
if (obj.hasOwnProperty(key)) {
95+
copy[key] = deepCopy(obj[key]);
96+
}
97+
}
98+
return copy;
99+
}
100+
const schema = ref(deepCopy(props.schema));
87101
88102
const itemLabelWidthProp = useItemLabelWidth(schema, formPropsRef);
89103

0 commit comments

Comments
 (0)