Skip to content

Commit 726e476

Browse files
committed
fix: search bug
1 parent 24fa1c8 commit 726e476

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

miniprogram/pages/search/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ Page({
3232
},
3333

3434
handleSearch({ detail }) {
35-
if (detail.value == '') {
36-
this.setData({ result: [] })
37-
return
38-
};
39-
4035
this.setData({ isLoading: true })
4136
if (this.lastTrigger) {
4237
clearTimeout(this.lastTrigger)
@@ -47,6 +42,13 @@ Page({
4742
},
4843

4944
doSearch(keyword) {
45+
if (keyword == '') {
46+
this.setData({
47+
result: [],
48+
isLoading: false
49+
})
50+
return
51+
};
5052
const fuzzySearch = (key) => {
5153
if (typeof key == 'string') return key.indexOf(keyword) > -1
5254
if (Array.isArray(key)) {

0 commit comments

Comments
 (0)