Skip to content

Bus.$emit('filterResultData', response.data); #60

@maxwellhertz

Description

@maxwellhertz

菜鸟想问一下 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方法呢?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions