axios传参问题

1.params传参,这里post后台会接收不到

updateStatus:function (id,status) {
                var _this = this;
                axios.get("/seller/updateStatus.do",{params:{id:id,status:status}}).then(function (response) {
                    alert(response.data.msg);
                    if(response.data.success)
                        _this.pageHandler(1);
                }).catch(function (reason) {
                    console.log(reason);
                });
            },

2.传递数组

axios.post("/brand/deleteBrand.do", Qs.stringify({deleteId: this.brandSelected}, {indices: false})
            ).then(function (response) {
                alert(response.data.msg);
                if (response.data.success) {
                    _this.pageHandler(1);
                }
            }).catch(function (reason) {
                console.log(reason);
            });

3.传递对象,注意后台接受的是一个json格式必须requestBody转下

axios.post(url, this.brand).then(function (response) {
                alert(response.data.msg);
                if (response.data.success) {
                    _this.pageHandler(1);
                }
            }).catch(function (reason) {
                console.log(reason);
            });
发布了47 篇原创文章 · 获赞 6 · 访问量 2203

猜你喜欢

转载自blog.csdn.net/weixin_44467251/article/details/102642170
今日推荐