mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-04-30 22:29:01 +08:00
fix(crud): 浅拷贝 -> 深拷贝
This commit is contained in:
parent
26ce0bd551
commit
0733b81f82
@ -6,6 +6,7 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { useForm, useModal } from '.'
|
||||
|
||||
const ACTIONS = {
|
||||
@ -21,7 +22,7 @@ export function useCrud({ name, initForm = {}, doCreate, doDelete, doUpdate, ref
|
||||
|
||||
/** 新增 */
|
||||
function handleAdd(row = {}, title) {
|
||||
handleOpen({ action: 'add', title, row: { ...initForm, ...row } })
|
||||
handleOpen({ action: 'add', title, row: Object.assign({}, cloneDeep(initForm), cloneDeep(row)) })
|
||||
}
|
||||
|
||||
/** 修改 */
|
||||
|
@ -6,9 +6,11 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
|
||||
export function useForm(initFormData = {}) {
|
||||
const formRef = ref(null)
|
||||
const formModel = ref({ ...initFormData })
|
||||
const formModel = ref(cloneDeep(initFormData))
|
||||
const rules = {
|
||||
required: {
|
||||
required: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user