fix(components): [pagination] delete input value display empty string (#12134)

This commit is contained in:
btea 2023-03-25 18:18:35 +08:00 committed by GitHub
parent d85ed0f6fa
commit 128fe7026a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,16 +35,16 @@ defineProps(paginationJumperProps)
const { t } = useLocale() const { t } = useLocale()
const ns = useNamespace('pagination') const ns = useNamespace('pagination')
const { pageCount, disabled, currentPage, changeEvent } = usePagination() const { pageCount, disabled, currentPage, changeEvent } = usePagination()
const userInput = ref<number>() const userInput = ref<number | string>()
const innerValue = computed(() => userInput.value ?? currentPage?.value) const innerValue = computed(() => userInput.value ?? currentPage?.value)
function handleInput(val: number | string) { function handleInput(val: number | string) {
userInput.value = +val userInput.value = val ? +val : ''
} }
function handleChange(val: number | string) { function handleChange(val: number | string) {
val = Math.trunc(+val) val = Math.trunc(+val)
changeEvent?.(+val) changeEvent?.(val)
userInput.value = undefined userInput.value = undefined
} }
</script> </script>