diff --git a/docs/markdown/changelog.md b/docs/markdown/changelog.md index 1d95078e..1446cd9d 100644 --- a/docs/markdown/changelog.md +++ b/docs/markdown/changelog.md @@ -8,3 +8,8 @@ - `BadgeGroup`重命名为`Sidebar` - `Badge`重命名为`SlidebarItem` + +##### Notify + +- `text`选项重命名为`message` +- `backgroundColor`选项重命名为`background` diff --git a/example/pages/notify/index.js b/example/pages/notify/index.js index c7553e56..5bcdb4f1 100644 --- a/example/pages/notify/index.js +++ b/example/pages/notify/index.js @@ -9,9 +9,9 @@ Page({ showNotify2() { Notify({ duration: 1000, - text: '通知内容', + message: '通知内容', selector: '#custom-selector', - backgroundColor: '#1989fa', + background: '#1989fa', safeAreaInsetTop: true }); }, diff --git a/package.json b/package.json index fc8db952..4e980f52 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "release": "sh build/release.sh", "release:site": "sh build/release-site.sh", "build:lib": "yarn && npx gulp -f build/compiler.js --series buildEs buildLib", - "build:changelog": "vant changelog --tag v0.5.0 ./docs/markdown/changelog.generated.md" + "build:changelog": "vant changelog --tag v1.0.0 ./docs/markdown/changelog.generated.md" }, "files": [ "dist", diff --git a/packages/notify/README.md b/packages/notify/README.md index 73b3a406..37fbfcbe 100644 --- a/packages/notify/README.md +++ b/packages/notify/README.md @@ -27,10 +27,10 @@ Notify('通知内容'); ```js Notify({ - text: '通知内容', + message: '通知内容', duration: 1000, selector: '#custom-selector', - backgroundColor: '#1989fa' + background: '#1989fa' }); ``` @@ -42,10 +42,10 @@ Notify({ | 参数 | 说明 | 类型 | 默认值 | |-----------|-----------|-----------|-------------| -| text | 展示文案 | *string* | - | +| message | 展示文案 | *string* | - | | duration | 持续时间 | *number* | `3000` | | selector | 自定义选择器 | *string* | `van-notify` | | color | 字体颜色 | *string* | `#fff` | | -| backgroundColor | 背景色 | *string* | `#f44` | +| background | 背景色 | *string* | `#f44` | | context | 选择器的选择范围,可以传入自定义组件的 this 作为上下文 | *object* | 当前页面 | | safe-area-inset-top | 是否留出顶部安全距离(状态栏高度 + 导航栏高度) | *boolean* | `false` | diff --git a/packages/notify/index.ts b/packages/notify/index.ts index b953d79b..983bf85e 100644 --- a/packages/notify/index.ts +++ b/packages/notify/index.ts @@ -6,12 +6,12 @@ VantComponent({ mixins: [safeArea()], props: { - text: String, + message: String, color: { type: String, value: '#fff' }, - backgroundColor: { + background: { type: String, value: RED }, diff --git a/packages/notify/index.wxml b/packages/notify/index.wxml index 96f58206..a91c40fd 100644 --- a/packages/notify/index.wxml +++ b/packages/notify/index.wxml @@ -2,8 +2,8 @@ name="slide-down" show="{{ show }}" custom-class="van-notify" - custom-style="background-color:{{ backgroundColor }}; color: {{ color }}; z-index: {{ zIndex }};" + custom-style="background:{{ background }}; color: {{ color }}; z-index: {{ zIndex }};" > - {{ text }} + {{ message }} diff --git a/packages/notify/notify.ts b/packages/notify/notify.ts index 39fc6353..e9649dbd 100644 --- a/packages/notify/notify.ts +++ b/packages/notify/notify.ts @@ -1,14 +1,12 @@ -import { isObj } from '../common/utils'; - interface NotifyOptions { - text: string; color?: string; - backgroundColor?: string; + zIndex?: number; + message: string; + context?: any; duration?: number; selector?: string; - context?: any; + background?: string; safeAreaInsetTop?: boolean; - zIndex?: number; } const defaultOptions = { @@ -16,8 +14,8 @@ const defaultOptions = { duration: 3000 }; -function parseOptions(text: NotifyOptions | string): NotifyOptions { - return isObj(text) ? (text as NotifyOptions) : ({ text } as NotifyOptions); +function parseOptions(message: NotifyOptions | string): NotifyOptions { + return typeof message === 'string' ? { message } : message; } function getContext() { diff --git a/packages/submit-bar/README.md b/packages/submit-bar/README.md index 4d40aa6b..31606899 100644 --- a/packages/submit-bar/README.md +++ b/packages/submit-bar/README.md @@ -68,16 +68,16 @@ | 参数 | 说明 | 类型 | 默认值 | |-----------|-----------|-----------|-------------| -| price | 价格(单位分) | *number* | - | -| label | 价格文案 | *string* | `合计:` | +| price | 价格(单位分) | *number* | - | +| label | 价格文案 | *string* | `合计:` | | suffix-label | 价格右侧文案 | *string* | - | | button-text | 按钮文字 | *string* | - | | button-type | 按钮类型 | *string* | `danger` | -| tip | 提示文案 | *string \| boolean* | - | +| tip | 提示文案 | *string \| boolean* | - | | tip-icon | 图标名称或图片链接,可选值见 Icon 组件 | *string* | - | -| disabled | 是否禁用按钮 | *boolean* | `false` | -| loading | 是否显示加载中的按钮 | *boolean* | `false` | -| currency | 货币符号 | *string* | `¥` | +| disabled | 是否禁用按钮 | *boolean* | `false` | +| loading | 是否显示加载中的按钮 | *boolean* | `false` | +| currency | 货币符号 | *string* | `¥` | | safe-area-inset-bottom | 是否为 iPhoneX 留出底部安全距离 | *boolean* | `true` | | decimal-length | 价格小数点后位数 | *number* | `2` |