Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maxwellhertz opened this issue Sep 15, 2018 · 0 comments
Open

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

maxwellhertz opened this issue Sep 15, 2018 · 0 comments

Comments

@maxwellhertz
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant