fix(VxeTable): update vxeTable ,fix imports and support theme change

This commit is contained in:
jinmao88
2024-06-24 16:33:55 +08:00
parent e7868e7193
commit cae5538aba
4 changed files with 20 additions and 10 deletions

View File

@@ -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"
},

View File

@@ -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 });

View File

@@ -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<VxeGridInstance>();
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) => {

View File

@@ -1,4 +1,4 @@
import { VXETable } from '..';
import { VxeUI } from '..';
import componentSetting from '@/settings/componentSetting';
VXETable.setup(componentSetting.vxeTable);
VxeUI.setConfig(componentSetting.vxeTable);