Error in onLoad hook: “TypeError: _regenerator.default.mark is not a function”
mp.runtime.esm.js?66fd:5817 TypeError: _regenerator.default.mark is not a function
报错图
原因分析
错误写法
这样 async 与 await 配合不行,需要直接使用then写法
// 获取详情数据
async getDetailFun() {
const res = await this.$api.lecture.detail(this.id);
this.detail = res.data
console.log("detail:",this.detail)
},
正确写法
// 获取详情数据
getDetailFun() {
this.$api.lecture.detail(this.id).then(res => {
if (res.code === 200) {
this.detail = res.data
console.log("detail:", this.detail)
}
});
},