一直出现router使用不能识别,在axios中使用js路由我用的是function
axios.get('/user', {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
然后打印出this,出现undefined,没有this对象,将function改变箭头函数
axios.get('/user', {
params: {
ID: 12345
}
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.log(error);
});
this对象就出来了