fix: trim spaces for search keyword

This commit is contained in:
三咲智子 2023-01-09 16:36:24 +08:00
parent 509eec5f87
commit c28d1e1537
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
3 changed files with 20 additions and 16 deletions

View file

@ -77,17 +77,19 @@ const activate = () => {
<!-- Results -->
<div left-0 top-12 absolute w-full z10 group-focus-within="pointer-events-auto visible" invisible pointer-events-none>
<div w-full bg-base border="~ base" rounded-3 max-h-100 overflow-auto py2>
<span v-if="query.length === 0" block text-center text-sm text-secondary>
<span v-if="query.trim().length === 0" block text-center text-sm text-secondary>
{{ t('search.search_desc') }}
</span>
<template v-if="!loading">
<SearchResult
v-for="(result, i) in results" :key="result.id"
:active="index === parseInt(i.toString())"
:result="result"
:tabindex="focused ? 0 : -1"
/>
<span v-if="query.length !== 0 && results.length === 0" block text-center text-sm text-secondary>
<template v-else-if="!loading">
<template v-if="results.length > 0">
<SearchResult
v-for="(result, i) in results" :key="result.id"
:active="index === parseInt(i.toString())"
:result="result"
:tabindex="focused ? 0 : -1"
/>
</template>
<span v-else block text-center text-sm text-secondary>
{{ t('search.search_empty') }}
</span>
</template>