created () { this.init()
},
methods: {
init () { this.getToken() this.getData()
}, async getToken () { let token = await postToken()
...
}, async getData () { if(this.token) return 'token no null'
let data = await postData();
....
}
}代码大致如上,实际运行时总是报'token no null',不是已经给两个用到ajax方法加async await了吗,为什么还是异步?
添加回答
举报
0/150
提交
取消