feat: 价目搜索支持英文名(card.en / meta.enName / 静态表)
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 5s
PR Preview / test (pull_request) Successful in 6s
PR Preview / deploy-preview (pull_request) Successful in 14s
Test / e2e-test (push) Failing after 3m2s
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 5s
PR Preview / test (pull_request) Successful in 6s
PR Preview / deploy-preview (pull_request) Successful in 14s
Test / e2e-test (push) Failing after 3m2s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
<!-- Search + View Toggle + Add + PDF -->
|
||||
<div style="display:flex;gap:6px;align-items:center;margin-bottom:12px;flex-wrap:nowrap">
|
||||
<div class="search-box" style="flex:1;min-width:140px;margin-bottom:0">
|
||||
<input class="search-input" v-model="searchQuery" placeholder="搜索精油名称…" style="width:100%" />
|
||||
<input class="search-input" v-model="searchQuery" placeholder="搜索中文或英文名…" style="width:100%" />
|
||||
</div>
|
||||
<div style="display:flex;border:1.5px solid var(--border);border-radius:10px;overflow:hidden;flex-shrink:0">
|
||||
<button @click="viewMode = 'bottle'" :style="viewMode === 'bottle' ? 'background:var(--sage);color:white' : 'background:white;color:var(--text-mid)'" style="border:none;border-radius:0;font-size:12px;padding:6px 12px;cursor:pointer">每瓶价</button>
|
||||
@@ -672,8 +672,14 @@ const filteredOilNames = computed(() => {
|
||||
if (!searchQuery.value.trim()) return oils.oilNames
|
||||
const q = searchQuery.value.trim().toLowerCase()
|
||||
return oils.oilNames.filter(n => {
|
||||
const en = getEnglishName(n).toLowerCase()
|
||||
return n.toLowerCase().includes(q) || en.includes(q)
|
||||
if (n.toLowerCase().includes(q)) return true
|
||||
const card = getOilCard(n)
|
||||
if (card?.en && card.en.toLowerCase().includes(q)) return true
|
||||
const meta = oils.oilsMeta[n]
|
||||
if (meta?.enName && meta.enName.toLowerCase().includes(q)) return true
|
||||
const fallback = oilEn(n)
|
||||
if (fallback && fallback.toLowerCase().includes(q)) return true
|
||||
return false
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user