1
0
mirror of https://gitee.com/vant-contrib/vant-weapp.git synced 2025-04-06 03:58:05 +08:00

fix(stepper): fix unable update value in async change ()

This commit is contained in:
landluck 2023-01-12 10:53:05 +08:00 committed by GitHub
parent 965734328c
commit e9d521a8d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions
packages
common
definitions
stepper

@ -23,6 +23,7 @@ function VantComponent<
mapKeys(vantOptions, options, {
data: 'data',
props: 'properties',
watch: 'observers',
mixins: 'behaviors',
methods: 'methods',
beforeCreate: 'created',

@ -24,6 +24,8 @@ export type VantComponentOptions<
mixin: string;
};
watch?: Record<string, (...args: any[]) => any>;
methods?: Methods;
// lifetimes

@ -22,7 +22,6 @@ VantComponent({
props: {
value: {
type: null,
observer: 'observeValue',
},
integer: {
type: Boolean,
@ -74,6 +73,12 @@ VantComponent({
currentValue: '',
},
watch: {
value() {
this.observeValue();
},
},
created() {
this.setData({
currentValue: this.format(this.data.value),
@ -82,11 +87,8 @@ VantComponent({
methods: {
observeValue() {
const { value, currentValue } = this.data;
if (!equal(value, currentValue)) {
this.setData({ currentValue: this.format(value) });
}
const { value } = this.data;
this.setData({ currentValue: this.format(value) });
},
check() {