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 (#5191)
This commit is contained in:
parent
965734328c
commit
e9d521a8d2
packages
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user