1
0
mirror of synced 2025-12-10 07:58:13 +08:00

支持暗黑模式

This commit is contained in:
xuliangzhan
2024-05-08 16:01:04 +08:00
parent c42c39414a
commit 1cb95a3bd2
17 changed files with 589 additions and 284 deletions

View File

@@ -8,6 +8,7 @@ import { formats } from './src/formats'
import { validators } from './src/validators'
import { hooks } from './src/hooks'
import { config } from './src/config'
import { setTheme } from './src/theme'
import { getLastZIndex, nextZIndex } from '../tools/utils'
import { VXETableCore } from '../../types/all'
@@ -106,6 +107,8 @@ export const VXETable = {
globalConfs
} as VXETableCore
setTheme(globalStore)
export * from './src/interceptor'
export * from './src/renderer'
export * from './src/commands'

View File

@@ -1,6 +1,7 @@
import GlobalConfig from './conf'
import XEUtils from 'xe-utils'
import DomZIndex from 'dom-zindex'
import { setTheme } from './theme'
import { VxeGlobalConfigMethod } from '../../../types/all'
@@ -8,8 +9,11 @@ import { VxeGlobalConfigMethod } from '../../../types/all'
* 全局参数设置
*/
export const config: VxeGlobalConfigMethod = (options) => {
if (options && options.zIndex) {
DomZIndex.setCurrent(options.zIndex)
if (options) {
setTheme(options)
if (options.zIndex) {
DomZIndex.setCurrent(options.zIndex)
}
}
return XEUtils.merge(GlobalConfig, options)
}

View File

@@ -0,0 +1,11 @@
import GlobalConfig from './conf'
export function setTheme (options: any) {
const theme = (options ? options.theme : null) || GlobalConfig.theme || 'default'
if (typeof document !== 'undefined') {
const documentElement = document.documentElement
if (documentElement) {
documentElement.setAttribute('data-vxe-table-theme', theme)
}
}
}