fix: update judgment

This commit is contained in:
btea
2023-03-21 21:34:41 +08:00
parent 368a42f61e
commit 23b8d203ce

View File

@@ -379,7 +379,8 @@ const handleInput = async (event: Event) => {
if (props.countGraphemes && isFunction(props.countGraphemes)) {
const graphemes = props.countGraphemes(value)
if (graphemes > Number(maxlength.value) && saveValue.value) {
const saveGraphemes = props.countGraphemes(saveValue.value)
if (graphemes > Number(maxlength.value) && graphemes > saveGraphemes) {
value = saveValue.value
}
}
@@ -490,6 +491,14 @@ watch(
}
)
watch(
() => nativeInputValue.value,
(val) => {
saveValue.value = val
},
{ immediate: true }
)
// native input value is set explicitly
// do not use v-model / :value in template
// see: https://github.com/ElemeFE/element/issues/14521