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
+30 -4
View File
@@ -17,13 +17,38 @@ Vue.use(Notify);
Notify('通知内容');
```
### 自定义配置
### 通知类型
支持`primary`、`success`、`warning`、`danger`四种通知类型,默认为`danger`
```js
// 主要通知
Notify({ type: 'primary', message: '通知内容' });
// 成功通知
Notify({ type: 'success', message: '通知内容' });
// 危险通知
Notify({ type: 'danger', message: '通知内容' });
// 警告通知
Notify({ type: 'warning', message: '通知内容' });
```
### 自定义通知
自定义消息通知的颜色和展示时长
```js
Notify({
message: '通知内容',
duration: 1000,
background: '#1989fa'
message: '自定义颜色',
color: '#ad0000',
background: '#ffe1e1'
});
Notify({
message: '自定义时长',
duration: 1000
});
```
@@ -54,6 +79,7 @@ export default {
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|------|------|------|------|------|
| type | 类型,可选值为 `primary` `info` `warning` | `string` | `danger` | 2.1.6 |
| message | 展示文案,支持通过`\n`换行 | `string` | - | - |
| duration | 展示时长(ms),值为 0 时,notify 不会消失 | `number` | `3000` | - |
| color | 字体颜色 | `string` | `#fff` | - |