diff --git a/docs/en-US/component/notification.md b/docs/en-US/component/notification.md index a65987770f..a34cc9556a 100644 --- a/docs/en-US/component/notification.md +++ b/docs/en-US/component/notification.md @@ -91,6 +91,13 @@ Element Plus has added a global method `$notify` for `app.config.globalPropertie ```javascript import { ElNotification } from 'element-plus' +import { CloseBold } from '@element-plus/icons-vue' + +ElNotification({ + title: 'Title', + message: 'This is a message', + closeIcon: CloseBold +}) ``` In this case you should call `ElNotification(options)`. We have also registered methods for different types, e.g. `ElNotification.success(options)`. You can call `ElNotification.closeAll()` to manually close all the instances. @@ -136,6 +143,7 @@ ElNotification({}, appContext) | offset | offset from the top edge of the screen. Every Notification instance of the same moment should have the same offset | ^[number] | 0 | | appendTo | set the root element for the notification, default to `document.body` | ^[string] / ^[HTMLElement] | — | | zIndex | initial zIndex | ^[number] | 0 | +| closeIcon ^(2.9.8) | custom close icon, default is Close | ^[string] / ^[Component] | — | ### Method diff --git a/packages/components/notification/src/notification.ts b/packages/components/notification/src/notification.ts index 5b0b96409f..b2afa28825 100644 --- a/packages/components/notification/src/notification.ts +++ b/packages/components/notification/src/notification.ts @@ -1,3 +1,4 @@ +import { Close } from '@element-plus/icons-vue' import { buildProps, definePropType, iconPropType } from '@element-plus/utils' import type { AppContext, ExtractPropTypes, VNode } from 'vue' @@ -108,6 +109,13 @@ export const notificationProps = buildProps({ * @description initial zIndex */ zIndex: Number, + /** + * @description custom close icon, default is Close + */ + closeIcon: { + type: iconPropType, + default: Close, + }, } as const) export type NotificationProps = ExtractPropTypes diff --git a/packages/components/notification/src/notification.vue b/packages/components/notification/src/notification.vue index 893a1ecd29..f38b23082a 100644 --- a/packages/components/notification/src/notification.vue +++ b/packages/components/notification/src/notification.vue @@ -31,7 +31,7 @@ - + @@ -41,7 +41,7 @@