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() {
|
||||
this.setData({
|
||||
value: this.range(this.data.value)
|
||||
@ -49,7 +59,7 @@ VantComponent({
|
||||
},
|
||||
|
||||
onChange(type) {
|
||||
if (this[`${type}Disabled`]) {
|
||||
if (this.data[`${type}Disabled`]) {
|
||||
this.$emit('overlimit', type);
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<view class="van-stepper custom-class">
|
||||
<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"
|
||||
/>
|
||||
<input
|
||||
@ -12,7 +12,7 @@
|
||||
bind:blur="onBlur"
|
||||
/>
|
||||
<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"
|
||||
/>
|
||||
</view>
|
||||
|
Loading…
x
Reference in New Issue
Block a user