最近再学习 Vue.js想把 API 那里获得的数据赋值给 Post_List,但是打印出来变量一直没变 打印出来始终是 a?对 JS 不太了解,望大家指点下 export default { data() { const Login_Scope = this; let Post_List = 'a'; axios.get('/api/postList') .then(function (response) { console.log(response); Login_Scope.Post_List = response.data; }) .catch(function (error) { // vm.answer = 'Error! Could not reach the API. ' + error }); console.log(Post_List); return { postList: Post_List, } } };
添加回答
举报
0/150
提交
取消
