搜索框为空不能搜索

This commit is contained in:
2023-07-31 12:18:33 +08:00
parent 6e93d4de52
commit b336d86af1

View File

@@ -170,10 +170,11 @@ historyArr.data = JSON.parse(localStorage.getItem('historyArr')) || []
//搜索数据 //搜索数据
let seachList = (item) => { let seachList = (item) => {
let string = seachAllType.keyword let string = seachAllType.keyword
if (!string.replace(/\s/g, "")) return
if (historyArr.data.indexOf(seachAllType.keyword) === -1) { if (historyArr.data.indexOf(seachAllType.keyword) === -1) {
historyArr.data.push(seachAllType.keyword) historyArr.data.push(seachAllType.keyword)
} }
if (string.replace(/\s/g, "")) localStorage.setItem('historyArr', JSON.stringify(historyArr.data)); localStorage.setItem('historyArr', JSON.stringify(historyArr.data));
route.push({ route.push({
path: '/seachPage', path: '/seachPage',
query: { query: {