From 5f7150d9809e1e3b6556ae4c87784bbf78315172 Mon Sep 17 00:00:00 2001 From: landluck Date: Wed, 21 Dec 2022 11:57:40 +0800 Subject: [PATCH] fix(stepper): fixed displaying incorrect values when on blur (#5158) --- packages/stepper/index.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/stepper/index.ts b/packages/stepper/index.ts index 5aea0646..c25bf554 100644 --- a/packages/stepper/index.ts +++ b/packages/stepper/index.ts @@ -35,7 +35,7 @@ VantComponent({ disableInput: Boolean, decimalLength: { type: Number, - value: (null as unknown) as number, + value: null as unknown as number, observer: 'check', }, min: { @@ -97,14 +97,8 @@ VantComponent({ }, isDisabled(type: string) { - const { - disabled, - disablePlus, - disableMinus, - currentValue, - max, - min, - } = this.data; + const { disabled, disablePlus, disableMinus, currentValue, max, min } = + this.data; if (type === 'plus') { return disabled || disablePlus || currentValue >= max; @@ -119,6 +113,9 @@ VantComponent({ onBlur(event: WechatMiniprogram.InputBlur) { const value = this.format(event.detail.value); + + this.setData({ currentValue: value }); + this.$emit('blur', { ...event.detail, value,