From 2546ca58b82b26b7351c763afd58629fd6b55d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Wed, 29 Jan 2020 15:21:40 +0800 Subject: [PATCH] feat(Notify): duration to be string --- src/notify/Notify.tsx | 13 +++++-------- src/notify/README.md | 2 +- src/notify/README.zh-CN.md | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/notify/Notify.tsx b/src/notify/Notify.tsx index 09370b116..aff4b6283 100644 --- a/src/notify/Notify.tsx +++ b/src/notify/Notify.tsx @@ -16,8 +16,8 @@ import { PopupMixinProps } from '../mixins/popup/type'; export type NotifyProps = PopupMixinProps & { type: 'primary' | 'success' | 'danger' | 'warning'; color: string; - message: string | number; - duration: number; + message: number | string; + duration: number | string; className?: any; background: string; }; @@ -54,18 +54,15 @@ function Notify( Notify.props = { ...popupMixinProps, color: String, - background: String, - className: null as any, message: [Number, String], + duration: [Number, String], + className: null as any, + background: String, getContainer: [String, Function], type: { type: String, default: 'danger', }, - duration: { - type: Number, - default: 3000, - }, }; export default createComponent(Notify); diff --git a/src/notify/README.md b/src/notify/README.md index b63768cc0..e191cb863 100644 --- a/src/notify/README.md +++ b/src/notify/README.md @@ -70,7 +70,7 @@ export default { |------|------|------|------| | type `v2.1.6` | Can be set to `primary` `success` `warning` | *string* | `danger` | | message | Message | *string* | - | -| duration | Duration(ms), won't disappear if value is 0 | *number* | `3000` | +| duration | Duration(ms), won't disappear if value is 0 | *number \| string* | `3000` | | color | Message color | *string* | `#fff` | | | background | Background color | *string* | - | | className | Custom className | *any* | - | diff --git a/src/notify/README.zh-CN.md b/src/notify/README.zh-CN.md index 9e786e83e..ea2e5dbdf 100644 --- a/src/notify/README.zh-CN.md +++ b/src/notify/README.zh-CN.md @@ -81,7 +81,7 @@ export default { |------|------|------|------| | type `v2.1.6` | 类型,可选值为 `primary` `success` `warning` | *string* | `danger` | | message | 展示文案,支持通过`\n`换行 | *string* | - | -| duration | 展示时长(ms),值为 0 时,notify 不会消失 | *number* | `3000` | +| duration | 展示时长(ms),值为 0 时,notify 不会消失 | *number \| string* | `3000` | | color | 字体颜色 | *string* | `#fff` | | background | 背景颜色 | *string* | - | | className | 自定义类名 | *any* | - |