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