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,8 +40,8 @@ export default defineComponent({
40 } 40 }
41 41
42 function renderTag() { 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 const { tag } = item; 46 const { tag } = item;
47 if (!tag) return null; 47 if (!tag) return null;
@@ -60,16 +60,15 @@ export default defineComponent({ @@ -60,16 +60,15 @@ export default defineComponent({
60 if (!props.item) { 60 if (!props.item) {
61 return null; 61 return null;
62 } 62 }
63 - const { showTitle, isTop } = props; 63 + const { showTitle } = props;
64 const { name, icon } = props.item; 64 const { name, icon } = props.item;
65 const searchValue = props.searchValue || ''; 65 const searchValue = props.searchValue || '';
66 const index = name.indexOf(searchValue); 66 const index = name.indexOf(searchValue);
67 67
68 const beforeStr = name.substr(0, index); 68 const beforeStr = name.substr(0, index);
69 const afterStr = name.substr(index + searchValue.length); 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 return ( 72 return (
74 <> 73 <>
75 {renderIcon(icon!)} 74 {renderIcon(icon!)}
src/hooks/web/useMessage.tsx
1 import type { ModalFunc, ModalFuncProps } from 'ant-design-vue/lib/modal/Modal'; 1 import type { ModalFunc, ModalFuncProps } from 'ant-design-vue/lib/modal/Modal';
2 import type { MessageApi } from 'ant-design-vue/lib/message'; 2 import type { MessageApi } from 'ant-design-vue/lib/message';
3 -import type { VNodeTypes, CSSProperties } from 'vue';  
4 3
5 import { Modal, message as Message, notification } from 'ant-design-vue'; 4 import { Modal, message as Message, notification } from 'ant-design-vue';
6 import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons-vue'; 5 import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons-vue';
7 6
8 import { useSetting } from '/@/hooks/core/useSetting'; 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 export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; 22 export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
31 export declare type IconType = 'success' | 'info' | 'error' | 'warning'; 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 export interface ModalOptionsEx extends Omit<ModalFuncProps, 'iconType'> { 24 export interface ModalOptionsEx extends Omit<ModalFuncProps, 'iconType'> {
42 iconType: 'warning' | 'success' | 'error' | 'info'; 25 iconType: 'warning' | 'success' | 'error' | 'info';
43 } 26 }
@@ -118,7 +101,7 @@ notification.config({ @@ -118,7 +101,7 @@ notification.config({
118 export function useMessage() { 101 export function useMessage() {
119 return { 102 return {
120 createMessage: Message as MessageApi, 103 createMessage: Message as MessageApi,
121 - notification: notification as (arg: ArgsProps) => void, 104 + notification: notification as NotifyApi,
122 createConfirm: createConfirm, 105 createConfirm: createConfirm,
123 createSuccessModal, 106 createSuccessModal,
124 createErrorModal, 107 createErrorModal,
src/router/index.ts
@@ -37,7 +37,7 @@ export function resetRouter() { @@ -37,7 +37,7 @@ export function resetRouter() {
37 router.getRoutes().forEach((route) => { 37 router.getRoutes().forEach((route) => {
38 const { name } = route; 38 const { name } = route;
39 if (name && !resetWhiteNameList.includes(name as string)) { 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 }