mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[bugfix] Stepper: 修复组件不传 max 情况下,默认置灰的问题 (#269)
* 修复stepper文档错误 * 采用极大数字来代替 infinity
This commit is contained in:
parent
f888ea8566
commit
d7ce0a8cda
@ -2,8 +2,7 @@ Page(Object.assign({}, {
|
|||||||
data: {
|
data: {
|
||||||
stepper1: {
|
stepper1: {
|
||||||
stepper: 10,
|
stepper: 10,
|
||||||
min: 1,
|
min: 1
|
||||||
max: 20
|
|
||||||
},
|
},
|
||||||
stepper2: {
|
stepper2: {
|
||||||
stepper: 10,
|
stepper: 10,
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
<zan-stepper
|
<zan-stepper
|
||||||
stepper="{{ stepper1.stepper }}"
|
stepper="{{ stepper1.stepper }}"
|
||||||
min="{{ stepper1.min }}"
|
min="{{ stepper1.min }}"
|
||||||
max="{{ stepper1.max }}"
|
|
||||||
data-component-id="stepper1"
|
data-component-id="stepper1"
|
||||||
bind:change="handleZanStepperChange"
|
bind:change="handleZanStepperChange"
|
||||||
>
|
>
|
||||||
|
@ -30,19 +30,11 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleZanStepperChange({
|
handleZanStepperChange({
|
||||||
|
|
||||||
// stepper 代表操作后,应该要展示的数字,需要设置到数据对象里,才会更新页面展示
|
// stepper 代表操作后,应该要展示的数字,需要设置到数据对象里,才会更新页面展示
|
||||||
detail: stepper,
|
detail: stepper
|
||||||
|
|
||||||
// 模板中传入的 componentId,用于区分一个页面上的多个stepper
|
|
||||||
target: {
|
|
||||||
dataset: {
|
|
||||||
componentId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}) {
|
}) {
|
||||||
this.setData({
|
this.setData({
|
||||||
[`${componentId}.stepper`]: stepper
|
'stepper.stepper': stepper
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -57,7 +49,6 @@ Page({
|
|||||||
stepper="{{ stepper.stepper }}"
|
stepper="{{ stepper.stepper }}"
|
||||||
min="{{ stepper.min }}"
|
min="{{ stepper.min }}"
|
||||||
max="{{ stepper.max }}"
|
max="{{ stepper.max }}"
|
||||||
component-id="stepper"
|
|
||||||
bind:change="handleZanStepperChange"
|
bind:change="handleZanStepperChange"
|
||||||
>
|
>
|
||||||
</zan-stepper>
|
</zan-stepper>
|
||||||
@ -72,7 +63,6 @@ Page({
|
|||||||
| min | 计数器最小值 | Number | `1` | |
|
| min | 计数器最小值 | Number | `1` | |
|
||||||
| max | 计数器最大值 | Number | 无穷大 | |
|
| max | 计数器最大值 | Number | 无穷大 | |
|
||||||
| step | 步数 | Number | `1` | |
|
| step | 步数 | Number | `1` | |
|
||||||
| componentId | 用于区分输入框之间的唯一名称 | String | - | |
|
|
||||||
|
|
||||||
### Event
|
### Event
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
// Note that the bitwise operators and shift operators operate on 32-bit ints
|
||||||
|
// so in that case, the max safe integer is 2^31-1, or 2147483647
|
||||||
|
const VERY_LARGE_NUMBER = 2147483647;
|
||||||
|
|
||||||
Component({
|
Component({
|
||||||
properties: {
|
properties: {
|
||||||
size: String,
|
size: String,
|
||||||
@ -11,7 +15,7 @@ Component({
|
|||||||
},
|
},
|
||||||
max: {
|
max: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: Infinity
|
value: VERY_LARGE_NUMBER
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user