Skip to content

Commit

Permalink
docs(sites): fix site overview input error
Browse files Browse the repository at this point in the history
  • Loading branch information
gimmyhehe committed Mar 20, 2024
1 parent 8523a35 commit 22eb00c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions examples/sites/src/views/overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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')
Expand All @@ -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) => {
// 表格示例单独另起了许多路由,统一使用表格组件图标
Expand Down

0 comments on commit 22eb00c

Please sign in to comment.