feat: 配方卡片加入上传个人二维码功能 #5

Merged
hera merged 23 commits from feature/qr-upload-hint into main 2026-04-08 22:09:30 +00:00
Showing only changes of commit 66766197a4 - Show all commits

View File

@@ -8,6 +8,8 @@
type="text"
style="width:100%;padding:10px 14px;border:1.5px solid #d4cfc7;border-radius:10px;font-size:14px;margin-bottom:16px;outline:none;font-family:inherit;box-sizing:border-box"
@keydown.enter="submitPrompt"
@compositionstart="isComposing = true"
@compositionend="onCompositionEnd"
ref="promptInput"
/>
<div class="dialog-btn-row">
@@ -19,11 +21,12 @@
</template>
<script setup>
import { ref, watch, nextTick } from 'vue'
import { ref, watch, nextTick, shallowRef } from 'vue'
import { dialogState, closeDialog } from '../composables/useDialog'
const inputValue = ref('')
const promptInput = ref(null)
const isComposing = shallowRef(false)
watch(() => dialogState.visible, (v) => {
if (v && dialogState.type === 'prompt') {
@@ -46,7 +49,15 @@ function cancel() {
else closeDialog(null)
}
function submitPrompt() {
function onCompositionEnd(e) {
isComposing.value = false
// After compositionend, update the model value with the committed text
inputValue.value = e.target.value
}
function submitPrompt(e) {
// Ignore Enter during IME composition (e.g. Chinese input method confirming a character)
if (e.isComposing || isComposing.value) return
closeDialog(inputValue.value)
}
</script>