Commit 334a0ea8e5e7fe45ad4d0f0ac399bdb95ea0b023

Authored by Wit〆苗大
Committed by GitHub
1 parent bce6cee5

fix(TableAction): 修复outside模式引用时报错;VxeTable demo引用TableAction改为outside模式, 属性添加ke…

…epSource以解决警告 (#2544)

* fix(TableAction): 修复outside模式引用时报错: TypeError: Cannot read properties of undefined (reading 'value')

* perf(VxeTable): demo引用TableAction改为outside模式以解决警告; 属性添加keepSource以解决警告

---------

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
src/components/Table/src/components/TableAction.vue
@@ -91,7 +91,7 @@ @@ -91,7 +91,7 @@
91 .map((action) => { 91 .map((action) => {
92 const { popConfirm } = action; 92 const { popConfirm } = action;
93 return { 93 return {
94 - getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body, 94 + getPopupContainer: () => unref((table as any)?.wrapRef) ?? document.body,
95 type: 'link', 95 type: 'link',
96 size: 'small', 96 size: 'small',
97 ...action, 97 ...action,
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
128 128
129 function getTooltip(data: string | TooltipProps): TooltipProps { 129 function getTooltip(data: string | TooltipProps): TooltipProps {
130 return { 130 return {
131 - getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body, 131 + getPopupContainer: () => unref((table as any)?.wrapRef) ?? document.body,
132 placement: 'bottom', 132 placement: 'bottom',
133 ...(isString(data) ? { title: data } : data), 133 ...(isString(data) ? { title: data } : data),
134 }; 134 };
src/views/demo/table/VxeTable.vue
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 > 7 >
8 <VxeBasicTable ref="tableRef" v-bind="gridOptions"> 8 <VxeBasicTable ref="tableRef" v-bind="gridOptions">
9 <template #action="{ row }"> 9 <template #action="{ row }">
10 - <TableAction :actions="createActions(row)" /> 10 + <TableAction outside :actions="createActions(row)" />
11 </template> 11 </template>
12 </VxeBasicTable> 12 </VxeBasicTable>
13 </PageWrapper> 13 </PageWrapper>
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
27 27
28 const gridOptions = reactive<BasicTableProps>({ 28 const gridOptions = reactive<BasicTableProps>({
29 id: 'VxeTable', 29 id: 'VxeTable',
  30 + keepSource: true,
30 editConfig: { trigger: 'click', mode: 'cell', showStatus: true }, 31 editConfig: { trigger: 'click', mode: 'cell', showStatus: true },
31 columns: vxeTableColumns, 32 columns: vxeTableColumns,
32 toolbarConfig: { 33 toolbarConfig: {