mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(Stepper): add new prop async-change @rex-zsd (#1133)
This commit is contained in:
parent
37b616251c
commit
b85f044471
@ -1,3 +1,8 @@
|
||||
import Page from '../../common/page';
|
||||
import Toast from '../../dist/toast/toast';
|
||||
|
||||
Page();
|
||||
Page({
|
||||
onChange(event) {
|
||||
Toast(`change: ${event.detail}`);
|
||||
}
|
||||
});
|
||||
|
@ -6,6 +6,15 @@
|
||||
<van-stepper value="{{ value1 }}" disabled />
|
||||
</demo-block>
|
||||
|
||||
<demo-block title="异步变更">
|
||||
<van-stepper
|
||||
value="{{ 5 }}"
|
||||
integer
|
||||
async-change
|
||||
bind:change="onChange"
|
||||
/>
|
||||
</demo-block>
|
||||
|
||||
<demo-block title="高级用法" padding>
|
||||
<van-stepper
|
||||
value="{{ value2 }}"
|
||||
@ -15,3 +24,5 @@
|
||||
step="2"
|
||||
/>
|
||||
</demo-block>
|
||||
|
||||
<van-toast id="van-toast" />
|
||||
|
@ -52,6 +52,7 @@
|
||||
| integer | 是否只允许输入整数 | `Boolean` | `false` |
|
||||
| disabled | 是否禁用 | `Boolean` | `false` |
|
||||
| disable-input | 是否禁用input框 | `Boolean` | `false` |
|
||||
| async-change | 异步变更,为 `true` 时input值不变化,仅触发事件 | `Boolean` | `false` |
|
||||
|
||||
### Event
|
||||
|
||||
|
@ -17,6 +17,7 @@ VantComponent({
|
||||
value: Number,
|
||||
integer: Boolean,
|
||||
disabled: Boolean,
|
||||
asyncChange: Boolean,
|
||||
disableInput: Boolean,
|
||||
min: {
|
||||
type: null,
|
||||
@ -103,8 +104,10 @@ VantComponent({
|
||||
this.onChange('plus');
|
||||
},
|
||||
|
||||
triggerInput(value) {
|
||||
this.set({ value });
|
||||
triggerInput(value: string) {
|
||||
this.set({
|
||||
value: this.data.asyncChange ? this.data.value : value
|
||||
});
|
||||
this.$emit('change', value);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user