Open maxwellhertz opened 6 years ago
菜鸟想问一下 DbFilterinput.vue 里面的一行代码的作用:
filterResultData: _.debounce( function () { this.$axios.get("http://127.0.0.1:8000/api/persons", { params: { sex: this.formInline.sex, email: this.formInline.email, } }).then((response) => { response.data['sex'] = this.formInline.sex; response.data['email'] = this.formInline.email; Bus.$emit('filterResultData', response.data); // ? console.log(response.data); }).catch(function (response) { console.log(response) }); }, 500 ),
我知道_.debounce是为了限制发送 AJAX 请求的频率,但是为什么在收到后端的响应之后还要在调用一次filterResultData方法呢?
_.debounce
filterResultData
菜鸟想问一下 DbFilterinput.vue 里面的一行代码的作用:
我知道
_.debounce
是为了限制发送 AJAX 请求的频率,但是为什么在收到后端的响应之后还要在调用一次filterResultData
方法呢?