mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-16 00:49:40 +08:00
修复搜索输入过快响应内容错误的问题
This commit is contained in:
parent
f3587a32ed
commit
4813634e46
@ -11,6 +11,7 @@
|
|||||||
<div class="search-box">
|
<div class="search-box">
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
|
let timer
|
||||||
var searchForm = document.getElementById('dream-search-form')
|
var searchForm = document.getElementById('dream-search-form')
|
||||||
var target = [[${theme.config.page_config.search.search_target}]]
|
var target = [[${theme.config.page_config.search.search_target}]]
|
||||||
var searchInput = document.getElementById('halo-search-form-text-input')
|
var searchInput = document.getElementById('halo-search-form-text-input')
|
||||||
@ -30,7 +31,10 @@
|
|||||||
})
|
})
|
||||||
// 监听输入事件
|
// 监听输入事件
|
||||||
searchInput.addEventListener('input', function (event) {
|
searchInput.addEventListener('input', function (event) {
|
||||||
findResult(searchInput.value)
|
clearTimeout(timer)
|
||||||
|
timer = setTimeout(function () {
|
||||||
|
findResult(searchInput.value)
|
||||||
|
}, 150)
|
||||||
})
|
})
|
||||||
|
|
||||||
function removeHTMLTags(str) {
|
function removeHTMLTags(str) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user