修复:增强扫码与接口契约校验

This commit is contained in:
焦龙言
2026-07-27 04:00:40 +08:00
parent 1f23d92ffb
commit d1f0b9d48b
2 changed files with 253 additions and 20 deletions
@@ -64,10 +64,13 @@ const errorMessage = ref('')
let lastScanValue = ''
let lastScanAt = 0
function focusInput() {
function focusInput(selectValue = false) {
nextTick(() => {
if (!props.disabled) {
if (!props.disabled && !props.loading) {
inputRef.value?.focus()
if (selectValue) {
inputRef.value?.select()
}
}
})
}
@@ -90,7 +93,7 @@ function handleSubmit() {
} catch (error) {
errorMessage.value = error.message
emit('invalid', error.message)
focusInput()
focusInput(true)
return
}
@@ -118,11 +121,14 @@ function handleSubmit() {
onMounted(focusInput)
watch(() => props.loading, (loading) => {
if (!loading) {
focusInput()
watch(
() => [props.loading, props.disabled],
([loading, disabled]) => {
if (!loading && !disabled) {
focusInput()
}
}
})
)
</script>
<style lang="scss" scoped>