|
|
@@ -93,6 +93,7 @@ export default {
|
|
|
selCustomId:0,
|
|
|
sn:'',
|
|
|
searchKeyword: '',
|
|
|
+ searchTimer: null,
|
|
|
}
|
|
|
},
|
|
|
created(){
|
|
|
@@ -112,17 +113,36 @@ export default {
|
|
|
this.getCustomData()
|
|
|
},
|
|
|
handleSearch() {
|
|
|
+ // 清除可能存在的定时器
|
|
|
+ if (this.searchTimer) {
|
|
|
+ clearTimeout(this.searchTimer)
|
|
|
+ this.searchTimer = null
|
|
|
+ }
|
|
|
+
|
|
|
this.resetList()
|
|
|
this.getCustomData()
|
|
|
},
|
|
|
clearSearch() {
|
|
|
+ // 清除可能存在的定时器
|
|
|
+ if (this.searchTimer) {
|
|
|
+ clearTimeout(this.searchTimer)
|
|
|
+ this.searchTimer = null
|
|
|
+ }
|
|
|
+
|
|
|
this.searchKeyword = ''
|
|
|
this.resetList()
|
|
|
this.getCustomData()
|
|
|
},
|
|
|
appendNumber(num) {
|
|
|
this.searchKeyword += num.toString()
|
|
|
- this.handleSearch()
|
|
|
+ // 清除之前的定时器
|
|
|
+ if (this.searchTimer) {
|
|
|
+ clearTimeout(this.searchTimer)
|
|
|
+ }
|
|
|
+ // 设置新的定时器
|
|
|
+ this.searchTimer = setTimeout(() => {
|
|
|
+ this.handleSearch()
|
|
|
+ }, 900)
|
|
|
},
|
|
|
reachBottom() {
|
|
|
if (!this.list.finished) {
|