为了账号安全,请及时绑定邮箱和手机立即绑定

Vue 赋值问题

Vue 赋值问题

牛魔王的故事 2019-03-15 13:15:31
最近再学习 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,            }        }    };
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 343 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号