fix: 修复取件码输入框的响应式数据流问题

This commit is contained in:
yiqiu
2026-02-24 10:11:06 +08:00
committed by cnb
parent 326bb98012
commit b959bea496
2 changed files with 9 additions and 9 deletions
+8 -8
View File
@@ -59,7 +59,7 @@
</template>
<script setup lang="ts">
import { ref, inject, watch } from 'vue'
import { ref, inject, computed } from 'vue'
import { ArrowRightIcon } from 'lucide-vue-next'
import { useI18n } from 'vue-i18n'
@@ -73,25 +73,25 @@ interface InputStatus {
interface Props {
inputStatus: InputStatus
error?: boolean
modelValue: string
}
interface Emits {
submit: []
'update:code': [value: string]
'update:modelValue': [value: string]
}
defineProps<Props>()
const props = defineProps<Props>()
const emit = defineEmits<Emits>()
const isDarkMode = inject('isDarkMode')
const code = ref('')
const code = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
})
const isInputFocused = ref(false)
const codeInput = ref<HTMLInputElement>()
watch(code, (newValue) => {
emit('update:code', newValue)
})
defineExpose({
focus: () => codeInput.value?.focus()
})
+1 -1
View File
@@ -14,10 +14,10 @@
<div class="p-8">
<PageHeader :title="config.name" @title-click="toSend" />
<RetrieveForm
v-model="code"
:input-status="inputStatus"
:error="!!error"
@submit="handleSubmit"
@update:code="code = $event"
ref="retrieveFormRef"
/>
</div>