// 定义防抖函数
debounce(func, delay) {
let timerId;
return function(...args) {
const context = this;
clearTimeout(timerId);
timerId = setTimeout(() => {
func.apply(context, args);
}, delay);
};
},
//实时搜索
inputChange(e) {
this.$set(this.form, 'name', e)
this.searchList = []
this.$set(this.form, 'page', 1)
this.$set(this.form, 'page_size', 20)
console.log(e);
this.debounce(this.getList(), 1000)
},
//获取列表
getList() {
equipmentList(
this.form
).then(res => {
this.searchList = this.searchList.concat(res.data)
this.allPage = res.page_count
this.loadingStatus = this.form.page < this.allPage ? 'loadmore' : 'nomore';
}).catch(res => {
this.searchList = []
this.allPage = 1
this.loadingStatus = 'nomore'
})
},
05-09
6178

08-26