Browse Source

Merge pull request #1971 from lideming/fix-notification-default-config

fix(notification): addNotice didn't use defaultConfig
代强 1 year ago
parent
commit
d3a8f962b7
1 changed files with 6 additions and 5 deletions
  1. 6 5
      packages/semi-ui/notification/index.tsx

+ 6 - 5
packages/semi-ui/notification/index.tsx

@@ -98,6 +98,7 @@ class NotificationList extends BaseComponent<NotificationListProps, Notification
     }
     }
 
 
     static addNotice(notice: NoticeProps) {
     static addNotice(notice: NoticeProps) {
+        notice = { ...defaultConfig, ...notice };
         const id = notice.id ?? getUuid('notification');
         const id = notice.id ?? getUuid('notification');
         if (!ref) {
         if (!ref) {
             const { getPopupContainer } = notice;
             const { getPopupContainer } = notice;
@@ -137,23 +138,23 @@ class NotificationList extends BaseComponent<NotificationListProps, Notification
     }
     }
 
 
     static info(opts: NoticeProps) {
     static info(opts: NoticeProps) {
-        return this.addNotice({ ...defaultConfig, ...opts, type: 'info' });
+        return this.addNotice({ ...opts, type: 'info' });
     }
     }
 
 
     static success(opts: NoticeProps) {
     static success(opts: NoticeProps) {
-        return this.addNotice({ ...defaultConfig, ...opts, type: 'success' });
+        return this.addNotice({ ...opts, type: 'success' });
     }
     }
 
 
     static error(opts: NoticeProps) {
     static error(opts: NoticeProps) {
-        return this.addNotice({ ...defaultConfig, ...opts, type: 'error' });
+        return this.addNotice({ ...opts, type: 'error' });
     }
     }
 
 
     static warning(opts: NoticeProps) {
     static warning(opts: NoticeProps) {
-        return this.addNotice({ ...defaultConfig, ...opts, type: 'warning' });
+        return this.addNotice({ ...opts, type: 'warning' });
     }
     }
 
 
     static open(opts: NoticeProps) {
     static open(opts: NoticeProps) {
-        return this.addNotice({ ...defaultConfig, ...opts, type: 'default' });
+        return this.addNotice({ ...opts, type: 'default' });
     }
     }
 
 
     static close(id: string) {
     static close(id: string) {