我在登錄時(shí)候獲取到了token并存在localStorage里面,想知道如何在axios上請(qǐng)求數(shù)據(jù)console.log(localStorage.getItem("token")); // 這個(gè)可以成功輸出數(shù)據(jù)// 這是請(qǐng)求代碼
beforeCreate() { this.axios
.post(`/api/services/app/role/GetRoles`, { permission: ""
})
.then(response => { console.log(response.data.result);
})
.catch(function(error) { console.log(error);
});
}
};想問(wèn)一下這個(gè)如何才能把token帶上一并請(qǐng)求數(shù)據(jù),謝謝您的解答
添加回答
舉報(bào)
0/150
提交
取消