修复搜索输入过快响应内容错误的问题

This commit is contained in:
j m 2024-09-22 07:06:18 +08:00
parent f3587a32ed
commit 4813634e46

View File

@ -11,6 +11,7 @@
<div class="search-box">
<script th:inline="javascript">
$(function () {
let timer
var searchForm = document.getElementById('dream-search-form')
var target = [[${theme.config.page_config.search.search_target}]]
var searchInput = document.getElementById('halo-search-form-text-input')
@ -30,7 +31,10 @@
})
// 监听输入事件
searchInput.addEventListener('input', function (event) {
clearTimeout(timer)
timer = setTimeout(function () {
findResult(searchInput.value)
}, 150)
})
function removeHTMLTags(str) {