docs(sites): fix site overview input error (#1499)

This commit is contained in:
gimmyhehe 2024-03-22 09:01:19 +08:00 committed by GitHub
parent 8523a35980
commit ef5374396a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

View File

@ -12,10 +12,10 @@
<!-- 搜索 -->
<tiny-input
:placeholder="i18nByKey('searchComponents')"
v-model="value"
:modelValue="value"
class="ti-mb10 search-input"
:style="{ width: '100%', padding: '6px' }"
@input="searchHandler"
@update:modelValue="searchHandler"
>
<template #suffix>
<img class="ti-h24 ti-w24 cur-def" :src="searchSvg" />
@ -94,8 +94,8 @@ export default defineComponent({
}, delay)
}
}
function searchResultFn(event) {
const value = event
function searchResultFn(val) {
const value = val
const trimValue = value.replaceAll(' ', '').toLowerCase()
const currentValue = trimValue
const reg = new RegExp(currentValue, 'ig')
@ -120,9 +120,13 @@ export default defineComponent({
const { defaultThemeKey } = useTheme()
const { all: allPathParam, theme = defaultThemeKey } = useRoute().params
const allPath = allPathParam ? allPathParam + '/' : ''
const debounceSearch = debounce(searchResultFn, 300)
let fn = {
searchHandler: debounce(searchResultFn, 300),
searchHandler: (val) => {
state.value = val
debounceSearch(val)
},
getTo: (key) => `${import.meta.env.VITE_CONTEXT}${allPath}${lang}/${theme}/components/${key}`,
getSvg: (key) => {
// 使