From f7b09d1677d050c018bd11ee017204c9f098aec6 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 16 Feb 2021 13:57:05 +0800 Subject: [PATCH] feat(Notify): add lockScroll option (#8168) --- src/notify/Notify.tsx | 3 ++- src/notify/README.md | 1 + src/notify/README.zh-CN.md | 1 + src/notify/index.tsx | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/notify/Notify.tsx b/src/notify/Notify.tsx index 864ec0c38..2e8e61786 100644 --- a/src/notify/Notify.tsx +++ b/src/notify/Notify.tsx @@ -13,6 +13,7 @@ export default createComponent({ message: [Number, String], className: UnknownProp, background: String, + lockScroll: Boolean, type: { type: String as PropType, default: 'danger', @@ -34,7 +35,7 @@ export default createComponent({ overlay={false} position="top" duration={0.2} - lockScroll={false} + lockScroll={props.lockScroll} > {slots.default ? slots.default() : props.message} diff --git a/src/notify/README.md b/src/notify/README.md index ba2160965..55dcb96f2 100644 --- a/src/notify/README.md +++ b/src/notify/README.md @@ -107,6 +107,7 @@ export default { | color | Message color | _string_ | `white` | | | background | Background color | _string_ | - | | className | Custom className | _string \| Array \| object_ | - | +| lockScroll `v3.0.7` | Whether to lock background scroll | _boolean_ | `false` | | onClick | Callback function after click | _(event: MouseEvent) => void_ | - | | onOpened | Callback function after opened | _() => void_ | - | | onClose | Callback function after close | _() => void_ | - | diff --git a/src/notify/README.zh-CN.md b/src/notify/README.zh-CN.md index c3a7506c5..93f512a02 100644 --- a/src/notify/README.zh-CN.md +++ b/src/notify/README.zh-CN.md @@ -144,6 +144,7 @@ export default { | color | 字体颜色 | _string_ | `white` | | background | 背景颜色 | _string_ | - | | className | 自定义类名 | _string \| Array \| object_ | - | +| lockScroll `v3.0.7` | 是否锁定背景滚动 | _boolean_ | `false` | | onClick | 点击时的回调函数 | _(event: MouseEvent): void_ | - | | onOpened | 完全展示后的回调函数 | _() => void_ | - | | onClose | 关闭时的回调函数 | _() => void_ | - | diff --git a/src/notify/index.tsx b/src/notify/index.tsx index 3a997d98b..dda85d55f 100644 --- a/src/notify/index.tsx +++ b/src/notify/index.tsx @@ -15,6 +15,7 @@ export type NotifyOptions = { duration?: number; className?: unknown; background?: string; + lockScroll?: boolean; onClick?: (event: MouseEvent) => void; onClose?: () => void; onOpened?: () => void; @@ -74,6 +75,7 @@ function defaultOptions() { onOpened: undefined, duration: 3000, className: '', + lockScroll: false, background: undefined, } as NotifyOptions; }