From c031163f34d7ec16aa5a7a406d5467a18e527c79 Mon Sep 17 00:00:00 2001 From: vben Date: Mon, 4 Jan 2021 23:36:20 +0800 Subject: [PATCH] fix(table): fix edit-table not work --- .../Table/src/components/editable/EditableCell.vue | 6 ------ src/components/Table/src/hooks/useColumns.ts | 7 ++++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/Table/src/components/editable/EditableCell.vue b/src/components/Table/src/components/editable/EditableCell.vue index 28ff0ecb..a0b6e2f9 100644 --- a/src/components/Table/src/components/editable/EditableCell.vue +++ b/src/components/Table/src/components/editable/EditableCell.vue @@ -148,16 +148,10 @@ }); watchEffect(() => { - console.log('======================'); - console.log(1); - console.log('======================'); defaultValueRef.value = props.value; }); watchEffect(() => { - console.log('======================'); - console.log(2); - console.log('======================'); const { editable } = props.column; if (isBoolean(editable) || isBoolean(unref(getRowEditable))) { isEdit.value = !!editable || unref(getRowEditable); diff --git a/src/components/Table/src/hooks/useColumns.ts b/src/components/Table/src/hooks/useColumns.ts index 00b36dfc..ca88f7b7 100644 --- a/src/components/Table/src/hooks/useColumns.ts +++ b/src/components/Table/src/hooks/useColumns.ts @@ -117,7 +117,8 @@ export function useColumns( } const { ellipsis } = unref(propsRef); - columns.forEach((item) => { + const cloneColumns = cloneDeep(columns); + cloneColumns.forEach((item) => { const { customRender, slots } = item; handleItem( @@ -125,7 +126,7 @@ export function useColumns( Reflect.has(item, 'ellipsis') ? !!item.ellipsis : !!ellipsis && !customRender && !slots ); }); - return columns; + return cloneColumns; }); const getViewColumns = computed(() => { @@ -152,7 +153,7 @@ export function useColumns( column.customRender = renderEditCell(column); } }); - return viewColumns; + return columns; }); watch( -- GitLab