Browse Source

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

pull/2688/head
vben 4 years ago
parent
commit
14ba72dd1c
  1. 1
      package.json
  2. 22
      packages/types/src/utils.ts
  3. 3
      pnpm-lock.yaml
  4. 2
      src/components/SimpleMenu/src/components/Menu.vue
  5. 7
      src/components/SimpleMenu/src/components/SubMenuItem.vue
  6. 2
      src/logics/mitt/routeChange.ts
  7. 2
      src/main.ts

1
package.json

@ -125,6 +125,7 @@
"@vben/eslint-config": "workspace:*",
"@vben/stylelint-config": "workspace:*",
"@vben/ts-config": "workspace:*",
"@vben/types": "workspace:*",
"@vben/vite-config": "workspace:*",
"@vue/compiler-sfc": "^3.2.47",
"@vue/test-utils": "^2.3.2",

22
packages/types/src/utils.ts

@ -1,8 +1,3 @@
/**
*
*/
type AnyFunction = AnyNormalFunction | AnyPromiseFunction;
/**
*
*/
@ -13,6 +8,11 @@ type AnyPromiseFunction = (...arg: any) => PromiseLike<any>;
*/
type AnyNormalFunction = (...arg: any) => any;
/**
*
*/
type AnyFunction = AnyNormalFunction | AnyPromiseFunction;
/**
* T | null
*/
@ -35,6 +35,16 @@ type ReadonlyRecordable<T = any> = {
readonly [key: string]: T;
};
/**
* setTimeout
*/
type TimeoutHandle = ReturnType<typeof setTimeout>;
/**
* setInterval
*/
type IntervalHandle = ReturnType<typeof setInterval>;
export {
type AnyFunction,
type AnyPromiseFunction,
@ -43,4 +53,6 @@ export {
type NonNullable,
type Recordable,
type ReadonlyRecordable,
type TimeoutHandle,
type IntervalHandle,
};

3
pnpm-lock.yaml

@ -176,6 +176,9 @@ importers:
'@vben/ts-config':
specifier: workspace:*
version: link:internal/ts-config
'@vben/types':
specifier: workspace:*
version: link:packages/types
'@vben/vite-config':
specifier: workspace:*
version: link:internal/vite-config

2
src/components/SimpleMenu/src/components/Menu.vue

@ -22,7 +22,7 @@
import { useDesign } from '/@/hooks/web/useDesign';
import { propTypes } from '/@/utils/propTypes';
import { createSimpleRootMenuContext } from './useSimpleMenuContext';
import mitt from '/@/utils/mitt';
import { mitt } from '/@/utils/mitt';
export default defineComponent({
name: 'Menu',

7
src/components/SimpleMenu/src/components/SubMenuItem.vue

@ -56,6 +56,7 @@
</template>
<script lang="ts">
import { type TimeoutHandle, type Recordable } from '@vben/types';
import type { CSSProperties, PropType } from 'vue';
import type { SubMenuProvider } from './types';
import {
@ -77,7 +78,7 @@
import { Icon } from '/@/components/Icon';
import { Popover } from 'ant-design-vue';
import { isBoolean, isObject } from '/@/utils/is';
import mitt from '/@/utils/mitt';
import { mitt } from '/@/utils/mitt';
const DELAY = 200;
export default defineComponent({
@ -267,14 +268,14 @@
rootMenuEmitter.on(
'on-update-opened',
(data: boolean | (string | number)[] | Recordable) => {
(data: boolean | (string | number)[] | Recordable<any>) => {
if (unref(getCollapse)) return;
if (isBoolean(data)) {
state.opened = data;
return;
}
if (isObject(data) && rootProps.accordion) {
const { opend, parent, uidList } = data as Recordable;
const { opend, parent, uidList } = data as Recordable<any>;
if (parent === instance?.parent) {
state.opened = opend;
} else if (!uidList.includes(instance?.uid)) {

2
src/logics/mitt/routeChange.ts

@ -2,7 +2,7 @@
* 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
*/
import mitt from '/@/utils/mitt';
import { mitt } from '/@/utils/mitt';
import type { RouteLocationNormalized } from 'vue-router';
import { getRawRoute } from '/@/utils';

2
src/main.ts

@ -1,7 +1,7 @@
import 'uno.css';
import '@/design/index.less';
import '@/components/VxeTable/src/css/index.scss';
import 'ant-design-vue/dist/antd.css';
import 'ant-design-vue/dist/antd.less';
// Register icon sprite
import 'virtual:svg-icons-register';

Loading…
Cancel
Save