vue 使用axios post方法传参到java后台
使用官方的这种方法 后台取不到参数方法1:xios.post('/user', {firstName: 'Fred',lastName: 'Flintstone'}).then(function (response) {console.log(response);}).catch(function (error) {conso...
·
使用官方的这种方法 后台取不到参数
方法1:
xios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
方法二
// 发送 POST 请求
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
});
提供一种解决办法:
var params = new URLSearchParams();
params.append('userName', this.userName);
params.append('account',this.account);
axios.post('/aircraft/deptRoleBLH_findUserBy.do?',params)
.then(response => (this.Datas = response.data.json.userMaps))
.catch(error => console.log(error))
var params = new URLSearchParams();
params.append('userName', this.userName);
params.append('account',this.account);
axios.post('/aircraft/deptRoleBLH_findUserBy.do?',params)
.then(
response => (
this.Datas = response.data.json.userMaps
))
.catch(error => console.log(error))
更多推荐
已为社区贡献2条内容
所有评论(0)