需要在url后面拼接我表单中的user属性,怎么做
类似于这种格式http://xxx:9090/sss?username=1&password=2&.....
我是这样做的可是报错
var app = new Vue({
el: "#wrap",
data: {
user:{},//用来保存用户数据
},
methods:{
//用户登录
login(){
//发送登录请求JSON.stringify(this.user)
axios.get("http://localhost:8989/user/login?user="+JSON.stringify(this.user)).then(res=>{
console.log(res.data);
if(res.data.state){
alert(res.data.msg+",点击确定进入主页!");
//将登录用户信息放入localStorage key value
localStorage.setItem("user",JSON.stringify(res.data.user));
location.href="/success.html";
}else{
alert(res.data.msg);
}
});
}
}
});
报的错为
Request URL: http://localhost:8989/user/login?user={%22username%22:%22asd%22,%22password%22:%22asd%22}
Request Method: GET
Status Code: 400