diff --git a/docs/markdown/changelog.zh-CN.md b/docs/markdown/changelog.zh-CN.md index 7e58d8ab6..dd20fee5e 100644 --- a/docs/markdown/changelog.zh-CN.md +++ b/docs/markdown/changelog.zh-CN.md @@ -9,6 +9,7 @@ ##### Notify - 新增`onClose`选项 +- 新增`onOpened`选项 ##### Rate diff --git a/packages/notify/Notify.tsx b/packages/notify/Notify.tsx index 59a5dd35e..e3d8858a2 100644 --- a/packages/notify/Notify.tsx +++ b/packages/notify/Notify.tsx @@ -44,6 +44,9 @@ function Notify( onClick={(event: Event) => { emit(ctx, 'click', event); }} + onOpened={() => { + emit(ctx, 'opened'); + }} {...inherit(ctx)} > {props.message} diff --git a/packages/notify/en-US.md b/packages/notify/en-US.md index 8812fb0a1..e25950f7b 100644 --- a/packages/notify/en-US.md +++ b/packages/notify/en-US.md @@ -59,4 +59,5 @@ export default { | background | Background color | `String` | `#f44` | | className | Custom className | `String | Array | Object` | - | | onClick | Callback function after click | `Function` | - | +| onOpened | Callback function after opened | `Function` | - | | onClose | Callback function after close | `Function` | - | diff --git a/packages/notify/index.ts b/packages/notify/index.ts index 98f3f2218..f30884e10 100644 --- a/packages/notify/index.ts +++ b/packages/notify/index.ts @@ -25,6 +25,11 @@ function Notify(options: NotifyOptions) { if (instance.onClick) { instance.onClick(event); } + }, + opened() { + if (instance.onOpened) { + instance.onOpened(); + } } } }); @@ -54,7 +59,8 @@ function defaultOptions(): NotifyOptions { duration: 3000, className: '', onClose: null, - onClick: null + onClick: null, + onOpened: null }; } diff --git a/packages/notify/zh-CN.md b/packages/notify/zh-CN.md index c7d44329a..5e6ba8056 100644 --- a/packages/notify/zh-CN.md +++ b/packages/notify/zh-CN.md @@ -59,4 +59,5 @@ export default { | background | 背景颜色 | `String` | `#f44` | 1.4.7 | | className | 自定义类名 | `String | Array | Object` | - | 1.6.0 | | onClick | 点击时的回调函数 | `Function` | - | 2.0.0 | +| onOpened | 完全展示后的回调函数 | `Function` | - | 2.0.0 | | onClose | 关闭时的回调函数 | `Function` | - | 2.0.0 | diff --git a/packages/password-input/demo/index.vue b/packages/password-input/demo/index.vue index 8f438a039..2046836b4 100644 --- a/packages/password-input/demo/index.vue +++ b/packages/password-input/demo/index.vue @@ -28,7 +28,7 @@ diff --git a/types/notify.d.ts b/types/notify.d.ts index 1bce5b80c..077bcc041 100644 --- a/types/notify.d.ts +++ b/types/notify.d.ts @@ -10,6 +10,7 @@ export type NotifyOptions = { className?: any; background?: string; onClose?: (() => void) | null; + onOpened?: (() => void) | null; onClick?: ((event: Event) => void) | null; }