Procházet zdrojové kódy

fix(TableAction): 修复outside模式引用时报错;VxeTable demo引用TableAction改为outside模式, 属性添加keepSource以解决警告 (#2544)

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

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

---------

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
Wit〆苗大 před 2 roky
rodič
revize
334a0ea8e5

+ 2 - 2
src/components/Table/src/components/TableAction.vue

@@ -91,7 +91,7 @@
           .map((action) => {
             const { popConfirm } = action;
             return {
-              getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body,
+              getPopupContainer: () => unref((table as any)?.wrapRef) ?? document.body,
               type: 'link',
               size: 'small',
               ...action,
@@ -128,7 +128,7 @@
 
       function getTooltip(data: string | TooltipProps): TooltipProps {
         return {
-          getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body,
+          getPopupContainer: () => unref((table as any)?.wrapRef) ?? document.body,
           placement: 'bottom',
           ...(isString(data) ? { title: data } : data),
         };

+ 2 - 1
src/views/demo/table/VxeTable.vue

@@ -7,7 +7,7 @@
   >
     <VxeBasicTable ref="tableRef" v-bind="gridOptions">
       <template #action="{ row }">
-        <TableAction :actions="createActions(row)" />
+        <TableAction outside :actions="createActions(row)" />
       </template>
     </VxeBasicTable>
   </PageWrapper>
@@ -27,6 +27,7 @@
 
   const gridOptions = reactive<BasicTableProps>({
     id: 'VxeTable',
+    keepSource: true,
     editConfig: { trigger: 'click', mode: 'cell', showStatus: true },
     columns: vxeTableColumns,
     toolbarConfig: {