Commit 0c6b4483906587153310a6fd5fe06611b8015251

Authored by xingyu4j
1 parent aae0b8c3

feat: vxe 暗黑模式

yudao-ui-admin-vue3/src/plugins/vxeTable/index.scss
1 @import 'vxe-table/styles/variable.scss'; 1 @import 'vxe-table/styles/variable.scss';
2 @import 'vxe-table/styles/modules.scss'; 2 @import 'vxe-table/styles/modules.scss';
3 - 3 +// @import './theme/light.scss';
4 i { 4 i {
5 border-color: initial; 5 border-color: initial;
6 } 6 }
yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts
1 -import { App, unref } from 'vue' 1 +import { App, unref, watch } from 'vue'
2 import XEUtils from 'xe-utils' 2 import XEUtils from 'xe-utils'
3 import './index.scss' 3 import './index.scss'
4 import './renderer' 4 import './renderer'
5 import { i18n } from '@/plugins/vueI18n' 5 import { i18n } from '@/plugins/vueI18n'
  6 +import { useAppStore } from '@/store/modules/app'
6 import zhCN from 'vxe-table/lib/locale/lang/zh-CN' 7 import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
7 import enUS from 'vxe-table/lib/locale/lang/en-US' 8 import enUS from 'vxe-table/lib/locale/lang/en-US'
8 import { 9 import {
@@ -45,6 +46,18 @@ import { @@ -45,6 +46,18 @@ import {
45 Table 46 Table
46 } from 'vxe-table' 47 } from 'vxe-table'
47 48
  49 +const appStore = useAppStore()
  50 +watch(
  51 + () => appStore.getIsDark,
  52 + () => {
  53 + if (appStore.getIsDark) {
  54 + import('./theme/dark.scss')
  55 + } else {
  56 + import('./theme/light.scss')
  57 + }
  58 + },
  59 + { immediate: true }
  60 +)
48 // 全局默认参数 61 // 全局默认参数
49 VXETable.setup({ 62 VXETable.setup({
50 size: 'medium', // 全局尺寸 63 size: 'medium', // 全局尺寸
yudao-ui-admin-vue3/src/plugins/vxeTable/theme/dark.scss 0 → 100644
  1 +// 修改样式变量
  2 +//@import 'vxe-table/styles/variable.scss';
  3 +
  4 +/*font*/
  5 +$vxe-font-color: #e5e7eb;
  6 +$vxe-font-size: 14px !default;
  7 +$vxe-font-size-medium: 14px !default;
  8 +$vxe-font-size-small: 13px !default;
  9 +$vxe-font-size-mini: 12px !default;
  10 +
  11 +/*icon*/
  12 +$vxe-icon-font-family: Verdana, Arial, Tahoma !default;
  13 +$vxe-icon-background-color: #fff !default;
  14 +
  15 +$vxe-toolbar-background-color: #262626;
  16 +$vxe-toolbar-button-border: #dcdfe6 !default;
  17 +
  18 +$vxe-table-font-color: #e5e7eb;
  19 +$vxe-table-header-background-color: #262626;
  20 +$vxe-table-body-background-color: #141414;
  21 +$vxe-table-row-striped-background-color: #1d1d1d;
  22 +$vxe-table-row-hover-background-color: #262626;
  23 +$vxe-table-row-hover-striped-background-color: #1e1e1e;
  24 +$vxe-table-footer-background-color: #141414;
  25 +$vxe-table-row-current-background-color: #a7a3a3;
  26 +$vxe-table-column-current-background-color: #a7a3a3;
  27 +$vxe-table-column-hover-background-color: #a7a3a3;
  28 +$vxe-table-row-hover-current-background-color: #a7a3a3;
  29 +$vxe-table-menu-background-color: #262626;
  30 +$vxe-table-border-width: 0px !default;
  31 +$vxe-table-border-color: #dfe5f0 !default;
  32 +
  33 +$vxe-form-background-color: #141414;
  34 +
  35 +$vxe-pager-background-color: #262626;
  36 +
  37 +$vxe-input-background-color: #141414;
  38 +$vxe-select-panel-background-color: #141414;
  39 +$vxe-select-option-hover-background-color: #262626;
  40 +
  41 +/*button*/
  42 +$vxe-button-default-background-color: #262626;
  43 +$vxe-button-dropdown-panel-background-color: #141414;
  44 +
  45 +/*modal*/
  46 +$vxe-modal-header-background-color: #141414;
  47 +$vxe-modal-body-background-color: #141414;
  48 +$vxe-modal-border-color: #3b3b3b;
  49 +
  50 +@import 'vxe-table/styles/index';
yudao-ui-admin-vue3/src/plugins/vxeTable/theme/light.scss 0 → 100644
  1 +// 修改样式变量
  2 +
  3 +//$vxe-font-color: #606266;
  4 +
  5 +//$vxe-table-header-background-color: #f8f8f9;
  6 +//$vxe-toolbar-background-color:#262626;
  7 +//$vxe-button-default-background-color:#262626;
  8 +//$vxe-table-body-background-color: #151515;
  9 +//$vxe-table-row-striped-background-color: #1d1d1d;
  10 +//$vxe-table-row-hover-background-color: #262626;
  11 +//$vxe-table-row-hover-striped-background-color: #1e1e1e;
  12 +//$vxe-table-footer-background-color: #151515;
  13 +//$vxe-table-row-current-background-color: #8C8C8C;
  14 +//$vxe-table-column-current-background-color: #8C8C8C;
  15 +//$vxe-table-column-hover-background-color:#8C8C8C;
  16 +//$vxe-table-row-hover-current-background-color: #8C8C8C ;
  17 +//$vxe-pager-background-color: #151515;
  18 +//$vxe-table-menu-background-color: #262626;
  19 +//
  20 +//
  21 +//$vxe-input-background-color: #151515;
  22 +//$vxe-select-panel-background-color: #151515;
  23 +//$vxe-select-option-hover-background-color: #262626;
  24 +@import 'vxe-table/styles/index.scss';