diff --git a/src/packages/__VUE/input/index.taro.vue b/src/packages/__VUE/input/index.taro.vue index de86382a10..0b16c716ca 100644 --- a/src/packages/__VUE/input/index.taro.vue +++ b/src/packages/__VUE/input/index.taro.vue @@ -225,27 +225,24 @@ export default create({ const _onInput = (event: Event) => { const input = event.target as HTMLInputElement; let value = input.value; - if (props.maxLength && value.length > Number(props.maxLength)) { - value = value.slice(0, Number(props.maxLength)); - } updateValue(value); }; const updateValue = (value: string, trigger: InputFormatTrigger = 'onChange') => { + // #2178 & Taro #2642 + emit('update:modelValue', value); + if (props.maxLength && value.length > Number(props.maxLength)) { + value = value.slice(0, Number(props.maxLength)); + } if (props.type === 'digit') { value = formatNumber(value, false, false); } if (props.type === 'number') { value = formatNumber(value, true, true); } - if (props.formatter && trigger === props.formatTrigger) { value = props.formatter(value); } - - if (inputRef?.value.value !== value) { - inputRef.value.value = value; - } if (value !== props.modelValue) { emit('update:modelValue', value); // emit('change', value);