Commit cb1ae34f1120d2555ff039fc945235c3f45e13a8

Authored by vben
1 parent d9b19600

fix: fix notify type error

src/components/Menu/src/MenuContent.tsx
... ... @@ -40,8 +40,8 @@ export default defineComponent({
40 40 }
41 41  
42 42 function renderTag() {
43   - const { item, showTitle } = props;
44   - if (!item || showTitle) return null;
  43 + const { item, showTitle, isTop } = props;
  44 + if (!item || showTitle || isTop) return null;
45 45  
46 46 const { tag } = item;
47 47 if (!tag) return null;
... ... @@ -60,16 +60,15 @@ export default defineComponent({
60 60 if (!props.item) {
61 61 return null;
62 62 }
63   - const { showTitle, isTop } = props;
  63 + const { showTitle } = props;
64 64 const { name, icon } = props.item;
65 65 const searchValue = props.searchValue || '';
66 66 const index = name.indexOf(searchValue);
67 67  
68 68 const beforeStr = name.substr(0, index);
69 69 const afterStr = name.substr(index + searchValue.length);
70   - let cls = showTitle ? ['show-title'] : ['basic-menu__name'];
  70 + const cls = showTitle ? ['show-title'] : ['basic-menu__name'];
71 71  
72   - isTop && !showTitle && (cls = []);
73 72 return (
74 73 <>
75 74 {renderIcon(icon!)}
... ...
src/hooks/web/useMessage.tsx
1 1 import type { ModalFunc, ModalFuncProps } from 'ant-design-vue/lib/modal/Modal';
2 2 import type { MessageApi } from 'ant-design-vue/lib/message';
3   -import type { VNodeTypes, CSSProperties } from 'vue';
4 3  
5 4 import { Modal, message as Message, notification } from 'ant-design-vue';
6 5 import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons-vue';
7 6  
8 7 import { useSetting } from '/@/hooks/core/useSetting';
  8 +import { ArgsProps, ConfigProps } from 'ant-design-vue/lib/notification';
9 9  
10   -export interface ArgsProps {
11   - message: VNodeTypes;
12   - description?: VNodeTypes;
13   - btn?: VNodeTypes;
14   - key?: string;
15   - onClose?: () => void;
16   - duration?: number | null;
17   - icon?: VNodeTypes;
18   - placement?: NotificationPlacement;
19   - style?: CSSProperties;
20   - prefixCls?: string;
21   - class?: string;
22   - readonly type?: IconType;
23   - onClick?: () => void;
24   - top?: number;
25   - bottom?: number;
26   - getContainer?: () => HTMLElement;
27   - closeIcon?: VNodeTypes;
  10 +export interface NotifyApi {
  11 + info(config: ArgsProps): void;
  12 + success(config: ArgsProps): void;
  13 + error(config: ArgsProps): void;
  14 + warn(config: ArgsProps): void;
  15 + warning(config: ArgsProps): void;
  16 + open(args: ArgsProps): void;
  17 + close(key: String): void;
  18 + config(options: ConfigProps): void;
  19 + destroy(): void;
28 20 }
29 21  
30 22 export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
31 23 export declare type IconType = 'success' | 'info' | 'error' | 'warning';
32   -export interface ConfigProps {
33   - top?: string | number;
34   - bottom?: string | number;
35   - duration?: number;
36   - placement?: NotificationPlacement;
37   - getContainer?: () => HTMLElement;
38   - closeIcon?: VNodeTypes;
39   -}
40   -
41 24 export interface ModalOptionsEx extends Omit<ModalFuncProps, 'iconType'> {
42 25 iconType: 'warning' | 'success' | 'error' | 'info';
43 26 }
... ... @@ -118,7 +101,7 @@ notification.config({
118 101 export function useMessage() {
119 102 return {
120 103 createMessage: Message as MessageApi,
121   - notification: notification as (arg: ArgsProps) => void,
  104 + notification: notification as NotifyApi,
122 105 createConfirm: createConfirm,
123 106 createSuccessModal,
124 107 createErrorModal,
... ...
src/router/index.ts
... ... @@ -37,7 +37,7 @@ export function resetRouter() {
37 37 router.getRoutes().forEach((route) => {
38 38 const { name } = route;
39 39 if (name && !resetWhiteNameList.includes(name as string)) {
40   - router.removeRoute(name);
  40 + router.hasRoute(name) && router.removeRoute(name);
41 41 }
42 42 });
43 43 }
... ...