最近再學習 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, } } };
Vue 賦值問題
牛魔王的故事
2019-03-15 13:15:31