Commit 14ba72dd1ce9f741801141a991887b442dd9ec34

Authored by vben
1 parent be0d3539

fix: 主题样式设置无效,close #2685

package.json
... ... @@ -125,6 +125,7 @@
125 125 "@vben/eslint-config": "workspace:*",
126 126 "@vben/stylelint-config": "workspace:*",
127 127 "@vben/ts-config": "workspace:*",
  128 + "@vben/types": "workspace:*",
128 129 "@vben/vite-config": "workspace:*",
129 130 "@vue/compiler-sfc": "^3.2.47",
130 131 "@vue/test-utils": "^2.3.2",
... ...
packages/types/src/utils.ts
1 1 /**
2   - * 任意类型的函数
3   - */
4   -type AnyFunction = AnyNormalFunction | AnyPromiseFunction;
5   -
6   -/**
7 2 * 任意类型的异步函数
8 3 */
9 4 type AnyPromiseFunction = (...arg: any) => PromiseLike<any>;
... ... @@ -14,6 +9,11 @@ type AnyPromiseFunction = (...arg: any) =&gt; PromiseLike&lt;any&gt;;
14 9 type AnyNormalFunction = (...arg: any) => any;
15 10  
16 11 /**
  12 + * 任意类型的函数
  13 + */
  14 +type AnyFunction = AnyNormalFunction | AnyPromiseFunction;
  15 +
  16 +/**
17 17 * T | null 包装
18 18 */
19 19 type Nullable<T> = T | null;
... ... @@ -35,6 +35,16 @@ type ReadonlyRecordable&lt;T = any&gt; = {
35 35 readonly [key: string]: T;
36 36 };
37 37  
  38 +/**
  39 + * setTimeout 返回值类型
  40 + */
  41 +type TimeoutHandle = ReturnType<typeof setTimeout>;
  42 +
  43 +/**
  44 + * setInterval 返回值类型
  45 + */
  46 +type IntervalHandle = ReturnType<typeof setInterval>;
  47 +
38 48 export {
39 49 type AnyFunction,
40 50 type AnyPromiseFunction,
... ... @@ -43,4 +53,6 @@ export {
43 53 type NonNullable,
44 54 type Recordable,
45 55 type ReadonlyRecordable,
  56 + type TimeoutHandle,
  57 + type IntervalHandle,
46 58 };
... ...
pnpm-lock.yaml
... ... @@ -176,6 +176,9 @@ importers:
176 176 '@vben/ts-config':
177 177 specifier: workspace:*
178 178 version: link:internal/ts-config
  179 + '@vben/types':
  180 + specifier: workspace:*
  181 + version: link:packages/types
179 182 '@vben/vite-config':
180 183 specifier: workspace:*
181 184 version: link:internal/vite-config
... ...
src/components/SimpleMenu/src/components/Menu.vue
... ... @@ -22,7 +22,7 @@
22 22 import { useDesign } from '/@/hooks/web/useDesign';
23 23 import { propTypes } from '/@/utils/propTypes';
24 24 import { createSimpleRootMenuContext } from './useSimpleMenuContext';
25   - import mitt from '/@/utils/mitt';
  25 + import { mitt } from '/@/utils/mitt';
26 26  
27 27 export default defineComponent({
28 28 name: 'Menu',
... ...
src/components/SimpleMenu/src/components/SubMenuItem.vue
... ... @@ -56,6 +56,7 @@
56 56 </template>
57 57  
58 58 <script lang="ts">
  59 + import { type TimeoutHandle, type Recordable } from '@vben/types';
59 60 import type { CSSProperties, PropType } from 'vue';
60 61 import type { SubMenuProvider } from './types';
61 62 import {
... ... @@ -77,7 +78,7 @@
77 78 import { Icon } from '/@/components/Icon';
78 79 import { Popover } from 'ant-design-vue';
79 80 import { isBoolean, isObject } from '/@/utils/is';
80   - import mitt from '/@/utils/mitt';
  81 + import { mitt } from '/@/utils/mitt';
81 82  
82 83 const DELAY = 200;
83 84 export default defineComponent({
... ... @@ -267,14 +268,14 @@
267 268  
268 269 rootMenuEmitter.on(
269 270 'on-update-opened',
270   - (data: boolean | (string | number)[] | Recordable) => {
  271 + (data: boolean | (string | number)[] | Recordable<any>) => {
271 272 if (unref(getCollapse)) return;
272 273 if (isBoolean(data)) {
273 274 state.opened = data;
274 275 return;
275 276 }
276 277 if (isObject(data) && rootProps.accordion) {
277   - const { opend, parent, uidList } = data as Recordable;
  278 + const { opend, parent, uidList } = data as Recordable<any>;
278 279 if (parent === instance?.parent) {
279 280 state.opened = opend;
280 281 } else if (!uidList.includes(instance?.uid)) {
... ...
src/logics/mitt/routeChange.ts
... ... @@ -2,7 +2,7 @@
2 2 * Used to monitor routing changes to change the status of menus and tabs. There is no need to monitor the route, because the route status change is affected by the page rendering time, which will be slow
3 3 */
4 4  
5   -import mitt from '/@/utils/mitt';
  5 +import { mitt } from '/@/utils/mitt';
6 6 import type { RouteLocationNormalized } from 'vue-router';
7 7 import { getRawRoute } from '/@/utils';
8 8  
... ...
src/main.ts
1 1 import 'uno.css';
2 2 import '@/design/index.less';
3 3 import '@/components/VxeTable/src/css/index.scss';
4   -import 'ant-design-vue/dist/antd.css';
  4 +import 'ant-design-vue/dist/antd.less';
5 5 // Register icon sprite
6 6 import 'virtual:svg-icons-register';
7 7  
... ...