forked from opentiny/tiny-vue
docs(sites): fix site overview input error (#1499)
This commit is contained in:
parent
8523a35980
commit
ef5374396a
|
@ -12,10 +12,10 @@
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<tiny-input
|
<tiny-input
|
||||||
:placeholder="i18nByKey('searchComponents')"
|
:placeholder="i18nByKey('searchComponents')"
|
||||||
v-model="value"
|
:modelValue="value"
|
||||||
class="ti-mb10 search-input"
|
class="ti-mb10 search-input"
|
||||||
:style="{ width: '100%', padding: '6px' }"
|
:style="{ width: '100%', padding: '6px' }"
|
||||||
@input="searchHandler"
|
@update:modelValue="searchHandler"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<img class="ti-h24 ti-w24 cur-def" :src="searchSvg" />
|
<img class="ti-h24 ti-w24 cur-def" :src="searchSvg" />
|
||||||
|
@ -94,8 +94,8 @@ export default defineComponent({
|
||||||
}, delay)
|
}, delay)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function searchResultFn(event) {
|
function searchResultFn(val) {
|
||||||
const value = event
|
const value = val
|
||||||
const trimValue = value.replaceAll(' ', '').toLowerCase()
|
const trimValue = value.replaceAll(' ', '').toLowerCase()
|
||||||
const currentValue = trimValue
|
const currentValue = trimValue
|
||||||
const reg = new RegExp(currentValue, 'ig')
|
const reg = new RegExp(currentValue, 'ig')
|
||||||
|
@ -120,9 +120,13 @@ export default defineComponent({
|
||||||
const { defaultThemeKey } = useTheme()
|
const { defaultThemeKey } = useTheme()
|
||||||
const { all: allPathParam, theme = defaultThemeKey } = useRoute().params
|
const { all: allPathParam, theme = defaultThemeKey } = useRoute().params
|
||||||
const allPath = allPathParam ? allPathParam + '/' : ''
|
const allPath = allPathParam ? allPathParam + '/' : ''
|
||||||
|
const debounceSearch = debounce(searchResultFn, 300)
|
||||||
|
|
||||||
let fn = {
|
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}`,
|
getTo: (key) => `${import.meta.env.VITE_CONTEXT}${allPath}${lang}/${theme}/components/${key}`,
|
||||||
getSvg: (key) => {
|
getSvg: (key) => {
|
||||||
// 表格示例单独另起了许多路由,统一使用表格组件图标
|
// 表格示例单独另起了许多路由,统一使用表格组件图标
|
||||||
|
|
Loading…
Reference in New Issue