diff --git a/example/pages/notify/index.js b/example/pages/notify/index.js index 5bcdb4f1..838965b4 100644 --- a/example/pages/notify/index.js +++ b/example/pages/notify/index.js @@ -6,12 +6,20 @@ Page({ Notify('通知内容'); }, - showNotify2() { + showCustomColor() { + Notify({ + message: '通知内容', + selector: '#custom-selector', + background: '#1989fa', + safeAreaInsetTop: true + }); + }, + + showCustomDuration() { Notify({ duration: 1000, message: '通知内容', selector: '#custom-selector', - background: '#1989fa', safeAreaInsetTop: true }); }, diff --git a/example/pages/notify/index.wxml b/example/pages/notify/index.wxml index be58b262..8bb2b1cd 100644 --- a/example/pages/notify/index.wxml +++ b/example/pages/notify/index.wxml @@ -6,11 +6,12 @@ /> - 显示消息通知 + 基础用法 - - 显示自定义消息通知 + + 自定义颜色 + 自定义时长 diff --git a/packages/notify/README.md b/packages/notify/README.md index 37fbfcbe..41bb7a61 100644 --- a/packages/notify/README.md +++ b/packages/notify/README.md @@ -20,21 +20,39 @@ Notify('通知内容'); ``` ```html + ``` -### 自定义配置 +### 自定义通知 + +自定义消息通知的颜色和展示时长 ```js Notify({ - message: '通知内容', + message: '自定义颜色', + color: '#ad0000', + background: '#ffe1e1' +}); + +Notify({ + message: '自定义时长', + duration: 1000 +}); +``` + +### 自定义选择器 + +```js +Notify({ + message: '自定义节点选择器', duration: 1000, - selector: '#custom-selector', - background: '#1989fa' + selector: '#custom-selector' }); ``` ```html + ``` @@ -44,7 +62,7 @@ Notify({ |-----------|-----------|-----------|-------------| | message | 展示文案 | *string* | - | | duration | 持续时间 | *number* | `3000` | -| selector | 自定义选择器 | *string* | `van-notify` | +| selector | 自定义节点选择器 | *string* | `van-notify` | | color | 字体颜色 | *string* | `#fff` | | | background | 背景色 | *string* | `#f44` | | context | 选择器的选择范围,可以传入自定义组件的 this 作为上下文 | *object* | 当前页面 |