mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-25 10:56:35 +08:00
chore: improve watcher
This commit is contained in:
parent
f928063d6a
commit
c895bf1739
@ -66,8 +66,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
value() {
|
value(val) {
|
||||||
this.code = this.value;
|
this.code = val;
|
||||||
this.setValues();
|
this.setValues();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -118,9 +118,7 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
type() {
|
type: 'reset',
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
|
|
||||||
value(val) {
|
value(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
@ -127,10 +127,10 @@ export default createComponent({
|
|||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
rate: {
|
rate: {
|
||||||
handler() {
|
handler(rate) {
|
||||||
this.startTime = Date.now();
|
this.startTime = Date.now();
|
||||||
this.startRate = this.value;
|
this.startRate = this.value;
|
||||||
this.endRate = format(this.rate);
|
this.endRate = format(rate);
|
||||||
this.increase = this.endRate > this.startRate;
|
this.increase = this.endRate > this.startRate;
|
||||||
this.duration = Math.abs(
|
this.duration = Math.abs(
|
||||||
((this.startRate - this.endRate) * 1000) / this.speed
|
((this.startRate - this.endRate) * 1000) / this.speed
|
||||||
|
@ -65,9 +65,9 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
show() {
|
show(val) {
|
||||||
if (!this.transition) {
|
if (!this.transition) {
|
||||||
this.$emit(this.show ? 'show' : 'hide');
|
this.$emit(val ? 'show' : 'hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -73,8 +73,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
defaultIndex() {
|
defaultIndex(val) {
|
||||||
this.setIndex(this.defaultIndex);
|
this.setIndex(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -112,17 +112,17 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
max: 'check',
|
||||||
|
min: 'check',
|
||||||
|
integer: 'check',
|
||||||
|
decimalLength: 'check',
|
||||||
|
|
||||||
value(val) {
|
value(val) {
|
||||||
if (!equal(val, this.currentValue)) {
|
if (!equal(val, this.currentValue)) {
|
||||||
this.currentValue = this.format(val);
|
this.currentValue = this.format(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
max: 'check',
|
|
||||||
min: 'check',
|
|
||||||
integer: 'check',
|
|
||||||
decimalLength: 'check',
|
|
||||||
|
|
||||||
currentValue(val) {
|
currentValue(val) {
|
||||||
this.$emit('input', val);
|
this.$emit('input', val);
|
||||||
this.$emit('change', val, { name: this.name });
|
this.$emit('change', val, { name: this.name });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user