Vue-给后端传登陆的用户id
1.先通过session获取id
computed: {
userinfo() {
return JSON.parse(sessionStorage.getItem("userinfo"));
}
},
2.获取信息前传id给后端
let thiscom = this;
let getreponse = new api();
getreponse.getDataByGet(
"aggrouplist.do", //后端的接口
{ userid: thiscom.userinfo.userid }, //把后端给的字段赋值
res => {
console.log("用户树", res); //成功后获取的值
检查: