feat(Notify): add type prop (#4237)

This commit is contained in:
neverland
2019-08-26 09:48:43 +08:00
committed by GitHub
parent ae53f9b58f
commit 10b52963b8
11 changed files with 151 additions and 44 deletions
+8 -6
View File
@@ -1,5 +1,5 @@
import { createNamespace } from '../utils';
import { RED, WHITE } from '../utils/constant';
import { WHITE } from '../utils/constant';
import { inherit } from '../utils/functional';
import { PopupMixin } from '../mixins/popup';
import Popup from '../popup';
@@ -10,6 +10,7 @@ import { DefaultSlots } from '../utils/types';
import { PopupMixinProps } from '../mixins/popup/type';
export type NotifyProps = PopupMixinProps & {
type: 'primary' | 'success' | 'danger' | 'warning';
color: string;
message: string | number;
duration: number;
@@ -37,7 +38,7 @@ function Notify(
position="top"
overlay={false}
lockScroll={false}
class={[bem(), props.className]}
class={[bem([props.type]), props.className]}
{...inherit(ctx, true)}
>
{props.message}
@@ -47,17 +48,18 @@ function Notify(
Notify.props = {
...PopupMixin.props,
background: String,
className: null as any,
message: [Number, String],
getContainer: [String, Function],
type: {
type: String,
default: 'danger'
},
color: {
type: String,
default: WHITE
},
background: {
type: String,
default: RED
},
duration: {
type: Number,
default: 3000