mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
breaking change(Notify): rename text、backgroundColor option (#1919)
This commit is contained in:
parent
23c2936146
commit
439efea9ee
@ -8,3 +8,8 @@
|
|||||||
|
|
||||||
- `BadgeGroup`重命名为`Sidebar`
|
- `BadgeGroup`重命名为`Sidebar`
|
||||||
- `Badge`重命名为`SlidebarItem`
|
- `Badge`重命名为`SlidebarItem`
|
||||||
|
|
||||||
|
##### Notify
|
||||||
|
|
||||||
|
- `text`选项重命名为`message`
|
||||||
|
- `backgroundColor`选项重命名为`background`
|
||||||
|
@ -9,9 +9,9 @@ Page({
|
|||||||
showNotify2() {
|
showNotify2() {
|
||||||
Notify({
|
Notify({
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
text: '通知内容',
|
message: '通知内容',
|
||||||
selector: '#custom-selector',
|
selector: '#custom-selector',
|
||||||
backgroundColor: '#1989fa',
|
background: '#1989fa',
|
||||||
safeAreaInsetTop: true
|
safeAreaInsetTop: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"release": "sh build/release.sh",
|
"release": "sh build/release.sh",
|
||||||
"release:site": "sh build/release-site.sh",
|
"release:site": "sh build/release-site.sh",
|
||||||
"build:lib": "yarn && npx gulp -f build/compiler.js --series buildEs buildLib",
|
"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": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
@ -27,10 +27,10 @@ Notify('通知内容');
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
Notify({
|
Notify({
|
||||||
text: '通知内容',
|
message: '通知内容',
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
selector: '#custom-selector',
|
selector: '#custom-selector',
|
||||||
backgroundColor: '#1989fa'
|
background: '#1989fa'
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ Notify({
|
|||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|-----------|-----------|-----------|-------------|
|
|-----------|-----------|-----------|-------------|
|
||||||
| text | 展示文案 | *string* | - |
|
| message | 展示文案 | *string* | - |
|
||||||
| duration | 持续时间 | *number* | `3000` |
|
| duration | 持续时间 | *number* | `3000` |
|
||||||
| selector | 自定义选择器 | *string* | `van-notify` |
|
| selector | 自定义选择器 | *string* | `van-notify` |
|
||||||
| color | 字体颜色 | *string* | `#fff` | |
|
| color | 字体颜色 | *string* | `#fff` | |
|
||||||
| backgroundColor | 背景色 | *string* | `#f44` |
|
| background | 背景色 | *string* | `#f44` |
|
||||||
| context | 选择器的选择范围,可以传入自定义组件的 this 作为上下文 | *object* | 当前页面 |
|
| context | 选择器的选择范围,可以传入自定义组件的 this 作为上下文 | *object* | 当前页面 |
|
||||||
| safe-area-inset-top | 是否留出顶部安全距离(状态栏高度 + 导航栏高度) | *boolean* | `false` |
|
| safe-area-inset-top | 是否留出顶部安全距离(状态栏高度 + 导航栏高度) | *boolean* | `false` |
|
||||||
|
@ -6,12 +6,12 @@ VantComponent({
|
|||||||
mixins: [safeArea()],
|
mixins: [safeArea()],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
text: String,
|
message: String,
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
value: '#fff'
|
value: '#fff'
|
||||||
},
|
},
|
||||||
backgroundColor: {
|
background: {
|
||||||
type: String,
|
type: String,
|
||||||
value: RED
|
value: RED
|
||||||
},
|
},
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
name="slide-down"
|
name="slide-down"
|
||||||
show="{{ show }}"
|
show="{{ show }}"
|
||||||
custom-class="van-notify"
|
custom-class="van-notify"
|
||||||
custom-style="background-color:{{ backgroundColor }}; color: {{ color }}; z-index: {{ zIndex }};"
|
custom-style="background:{{ background }}; color: {{ color }}; z-index: {{ zIndex }};"
|
||||||
>
|
>
|
||||||
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-top" style="padding-top: {{ statusBarHeight }}px"></view>
|
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-top" style="padding-top: {{ statusBarHeight }}px"></view>
|
||||||
{{ text }}
|
{{ message }}
|
||||||
</van-transition>
|
</van-transition>
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
import { isObj } from '../common/utils';
|
|
||||||
|
|
||||||
interface NotifyOptions {
|
interface NotifyOptions {
|
||||||
text: string;
|
|
||||||
color?: string;
|
color?: string;
|
||||||
backgroundColor?: string;
|
zIndex?: number;
|
||||||
|
message: string;
|
||||||
|
context?: any;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
selector?: string;
|
selector?: string;
|
||||||
context?: any;
|
background?: string;
|
||||||
safeAreaInsetTop?: boolean;
|
safeAreaInsetTop?: boolean;
|
||||||
zIndex?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
@ -16,8 +14,8 @@ const defaultOptions = {
|
|||||||
duration: 3000
|
duration: 3000
|
||||||
};
|
};
|
||||||
|
|
||||||
function parseOptions(text: NotifyOptions | string): NotifyOptions {
|
function parseOptions(message: NotifyOptions | string): NotifyOptions {
|
||||||
return isObj(text) ? (text as NotifyOptions) : ({ text } as NotifyOptions);
|
return typeof message === 'string' ? { message } : message;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getContext() {
|
function getContext() {
|
||||||
|
@ -68,16 +68,16 @@
|
|||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|-----------|-----------|-----------|-------------|
|
|-----------|-----------|-----------|-------------|
|
||||||
| price | 价格(单位分) | *number* | - |
|
| price | 价格(单位分) | *number* | - |
|
||||||
| label | 价格文案 | *string* | `合计:` |
|
| label | 价格文案 | *string* | `合计:` |
|
||||||
| suffix-label | 价格右侧文案 | *string* | - |
|
| suffix-label | 价格右侧文案 | *string* | - |
|
||||||
| button-text | 按钮文字 | *string* | - |
|
| button-text | 按钮文字 | *string* | - |
|
||||||
| button-type | 按钮类型 | *string* | `danger` |
|
| button-type | 按钮类型 | *string* | `danger` |
|
||||||
| tip | 提示文案 | *string \| boolean* | - |
|
| tip | 提示文案 | *string \| boolean* | - |
|
||||||
| tip-icon | 图标名称或图片链接,可选值见 Icon 组件 | *string* | - |
|
| tip-icon | 图标名称或图片链接,可选值见 Icon 组件 | *string* | - |
|
||||||
| disabled | 是否禁用按钮 | *boolean* | `false` |
|
| disabled | 是否禁用按钮 | *boolean* | `false` |
|
||||||
| loading | 是否显示加载中的按钮 | *boolean* | `false` |
|
| loading | 是否显示加载中的按钮 | *boolean* | `false` |
|
||||||
| currency | 货币符号 | *string* | `¥` |
|
| currency | 货币符号 | *string* | `¥` |
|
||||||
| safe-area-inset-bottom | 是否为 iPhoneX 留出底部安全距离 | *boolean* | `true` |
|
| safe-area-inset-bottom | 是否为 iPhoneX 留出底部安全距离 | *boolean* | `true` |
|
||||||
| decimal-length | 价格小数点后位数 | *number* | `2` |
|
| decimal-length | 价格小数点后位数 | *number* | `2` |
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user