最近再學(xué)習(xí) Vue.js想把 API 那里獲得的數(shù)據(jù)賦值給 Post_List,但是打印出來(lái)變量一直沒(méi)變 打印出來(lái)始終是 a?對(duì) JS 不太了解,望大家指點(diǎn)下 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 賦值問(wèn)題
牛魔王的故事
2019-03-15 13:15:31