推荐一个很好的防抖工具lodash的debounce方法
在select的search方法中,使用如下调用方式
selectSearchFunc: _.debounce(function(value) {
xxx远程方法().then(res => {
// 回调处理
}
}, 500) // 500毫秒亲测还行,可自行配置
引用方法:
package.json中添加
"depedencies": {
"lodash": "^4.17.21"
}
main.js中添加
import _ from "lodash"
Vue.prototype._ = _
ok,尽情抖吧~~~