mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[bugfix] Stepper: disabled not work (#709)
This commit is contained in:
parent
1d72fd6ad5
commit
8ed16151f7
@ -31,6 +31,16 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
minusDisabled() {
|
||||||
|
return this.data.disabled || this.data.value <= this.data.min;
|
||||||
|
},
|
||||||
|
|
||||||
|
plusDisabled() {
|
||||||
|
return this.data.disabled || this.data.value >= this.data.max;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.setData({
|
this.setData({
|
||||||
value: this.range(this.data.value)
|
value: this.range(this.data.value)
|
||||||
@ -49,7 +59,7 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onChange(type) {
|
onChange(type) {
|
||||||
if (this[`${type}Disabled`]) {
|
if (this.data[`${type}Disabled`]) {
|
||||||
this.$emit('overlimit', type);
|
this.$emit('overlimit', type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<view class="van-stepper custom-class">
|
<view class="van-stepper custom-class">
|
||||||
<view
|
<view
|
||||||
class="minus-class van-stepper__minus {{ disabled || value <= min ? 'van-stepper__minus--disabled' : '' }}"
|
class="minus-class van-stepper__minus {{ minusDisabled ? 'van-stepper__minus--disabled' : '' }}"
|
||||||
bind:tap="onMinus"
|
bind:tap="onMinus"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
@ -12,7 +12,7 @@
|
|||||||
bind:blur="onBlur"
|
bind:blur="onBlur"
|
||||||
/>
|
/>
|
||||||
<view
|
<view
|
||||||
class="plus-class van-stepper__plus {{ disabled || value >= max ? 'van-stepper__plus--disabled' : '' }}"
|
class="plus-class van-stepper__plus {{ plusDisabled ? 'van-stepper__plus--disabled' : '' }}"
|
||||||
bind:tap="onPlus"
|
bind:tap="onPlus"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user