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
@ -23,6 +23,7 @@ function VantComponent<
|
|||||||
mapKeys(vantOptions, options, {
|
mapKeys(vantOptions, options, {
|
||||||
data: 'data',
|
data: 'data',
|
||||||
props: 'properties',
|
props: 'properties',
|
||||||
|
watch: 'observers',
|
||||||
mixins: 'behaviors',
|
mixins: 'behaviors',
|
||||||
methods: 'methods',
|
methods: 'methods',
|
||||||
beforeCreate: 'created',
|
beforeCreate: 'created',
|
||||||
|
@ -24,6 +24,8 @@ export type VantComponentOptions<
|
|||||||
mixin: string;
|
mixin: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch?: Record<string, (...args: any[]) => any>;
|
||||||
|
|
||||||
methods?: Methods;
|
methods?: Methods;
|
||||||
|
|
||||||
// lifetimes
|
// lifetimes
|
||||||
|
@ -22,7 +22,6 @@ VantComponent({
|
|||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: null,
|
type: null,
|
||||||
observer: 'observeValue',
|
|
||||||
},
|
},
|
||||||
integer: {
|
integer: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -74,6 +73,12 @@ VantComponent({
|
|||||||
currentValue: '',
|
currentValue: '',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
value() {
|
||||||
|
this.observeValue();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.setData({
|
this.setData({
|
||||||
currentValue: this.format(this.data.value),
|
currentValue: this.format(this.data.value),
|
||||||
@ -82,11 +87,8 @@ VantComponent({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
observeValue() {
|
observeValue() {
|
||||||
const { value, currentValue } = this.data;
|
const { value } = this.data;
|
||||||
|
this.setData({ currentValue: this.format(value) });
|
||||||
if (!equal(value, currentValue)) {
|
|
||||||
this.setData({ currentValue: this.format(value) });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user