diff --git a/package.json b/package.json index 840649d0..f28efaa9 100644 --- a/package.json +++ b/package.json @@ -107,8 +107,8 @@ "vue-router": "^4.3.2", "vue-types": "^5.1.1", "vuedraggable": "^4.1.0", - "vxe-table": "^4.6.3", - "vxe-table-plugin-export-xlsx": "^4.0.1", + "vxe-table": "^4.7.31", + "vxe-table-plugin-export-xlsx": "^4.0.2", "xe-utils": "^3.5.25", "xlsx": "^0.18.5" }, diff --git a/src/components/VxeTable/index.ts b/src/components/VxeTable/index.ts index d64701ba..029e48af 100644 --- a/src/components/VxeTable/index.ts +++ b/src/components/VxeTable/index.ts @@ -1,6 +1,6 @@ import { withInstall } from '@/utils'; import vxeBasicTable from './src/VxeBasicTable'; -import { VXETable } from 'vxe-table'; +import { VxeUI } from 'vxe-table'; import VXETablePluginAntd from './src/components'; import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'; import ExcelJS from 'exceljs'; @@ -10,4 +10,4 @@ export const VxeBasicTable = withInstall(vxeBasicTable); export * from 'vxe-table'; export * from './src/types'; -VXETable.use(VXETablePluginAntd).use(VXETablePluginExportXLSX, { ExcelJS }); +VxeUI.use(VXETablePluginAntd).use(VXETablePluginExportXLSX, { ExcelJS }); diff --git a/src/components/VxeTable/src/VxeBasicTable.tsx b/src/components/VxeTable/src/VxeBasicTable.tsx index e48cb10c..d51885d6 100644 --- a/src/components/VxeTable/src/VxeBasicTable.tsx +++ b/src/components/VxeTable/src/VxeBasicTable.tsx @@ -1,22 +1,25 @@ -import { defineComponent, computed, ref } from 'vue'; +import { defineComponent, computed, ref, watch } from 'vue'; import { BasicTableProps } from './types'; import { basicProps } from './props'; import { ignorePropKeys } from './const'; import { basicEmits } from './emits'; import XEUtils from 'xe-utils'; -import type { +import { VxeGridInstance, VxeGridEventProps, GridMethods, TableMethods, TableEditMethods, TableValidatorMethods, + VxeUI, + VxeGlobalThemeName, + VxeGrid, } from 'vxe-table'; -import { Grid as VxeGrid } from 'vxe-table'; import { extendSlots } from '@/utils/helper/tsxHelper'; import { gridComponentMethodKeys } from './methods'; import { omit } from 'lodash-es'; +import { useRootSetting } from '@/hooks/setting/useRootSetting'; export default defineComponent({ name: 'VxeBasicTable', @@ -25,7 +28,14 @@ export default defineComponent({ setup(props, { emit, attrs }) { const tableElRef = ref(); const emitEvents: VxeGridEventProps = {}; - + const { getDarkMode } = useRootSetting(); + watch( + () => getDarkMode.value, + () => { + VxeUI.setTheme(getDarkMode.value as VxeGlobalThemeName); + }, + { immediate: true }, + ); const extendTableMethods = (methodKeys) => { const funcs: any = {}; methodKeys.forEach((name) => { diff --git a/src/components/VxeTable/src/setting.ts b/src/components/VxeTable/src/setting.ts index ba3d0619..f5e32751 100644 --- a/src/components/VxeTable/src/setting.ts +++ b/src/components/VxeTable/src/setting.ts @@ -1,4 +1,4 @@ -import { VXETable } from '..'; +import { VxeUI } from '..'; import componentSetting from '@/settings/componentSetting'; -VXETable.setup(componentSetting.vxeTable); +VxeUI.setConfig(componentSetting.vxeTable);