支持暗黑模式
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { App } from 'vue'
|
||||
import XEUtils from 'xe-utils'
|
||||
import { config } from './v-x-e-table'
|
||||
import { setTheme } from './v-x-e-table/src/theme'
|
||||
|
||||
import { VxeTableFilterModule } from './filter'
|
||||
import { VxeTableMenuModule } from './menu'
|
||||
@@ -92,6 +93,7 @@ config({
|
||||
export function install (app: App, options: any) {
|
||||
if (XEUtils.isPlainObject(options)) {
|
||||
config(options)
|
||||
setTheme(options)
|
||||
}
|
||||
components.forEach(component => component.install(app))
|
||||
}
|
||||
|
||||
@@ -8,10 +8,6 @@ import { warnLog, errLog } from '../../tools/log'
|
||||
import { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/all'
|
||||
|
||||
export class ColumnInfo {
|
||||
title?: string
|
||||
type?: string
|
||||
field?: string
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
constructor ($xetable: VxeTableConstructor & VxeTablePrivateMethods, _vm: any, { renderHeader, renderCell, renderFooter, renderData }: any = {}) {
|
||||
const $xegrid = $xetable.xegrid
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
11
packages/v-x-e-table/src/theme.ts
Normal file
11
packages/v-x-e-table/src/theme.ts
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user