mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-17 13:01:46 +08:00
fix(components): [input] fix formatter and parse problem (#12622)
* fix(components): [input] fix formatter and parse problem closed #12613 * fix(components): [input] fix input value problem * fix(components): [input] update return value for input event emit * test(components): [input] add test for formatter and parser
This commit is contained in:
@ -371,8 +371,11 @@ const onceInitSizeTextarea = createOnceInitResize(resizeTextarea)
|
||||
|
||||
const setNativeInputValue = () => {
|
||||
const input = _ref.value
|
||||
if (!input || input.value === nativeInputValue.value) return
|
||||
input.value = nativeInputValue.value
|
||||
const formatterValue = props.formatter
|
||||
? props.formatter(nativeInputValue.value)
|
||||
: nativeInputValue.value
|
||||
if (!input || input.value === formatterValue) return
|
||||
input.value = formatterValue
|
||||
}
|
||||
|
||||
const handleInput = async (event: Event) => {
|
||||
@ -382,7 +385,6 @@ const handleInput = async (event: Event) => {
|
||||
|
||||
if (props.formatter) {
|
||||
value = props.parser ? props.parser(value) : value
|
||||
value = props.formatter(value)
|
||||
}
|
||||
|
||||
// should not emit input during composition
|
||||
|
Reference in New Issue
Block a user