每日学习
1、uniapp小程序 正确的在methods里面添加方法:
methods: {
getQuestion() {
http.get(‘/question/query’).then(res => {
if (res.code == 0 && res.data != null) {
this.questionList = res.data.data
}
})
},
},
每日总结
1、新添加的页面实现跳转了,但是内容没有显示、单词不熟练
(1)[Vue warn]: Error in onShow hook: “TypeError: this.getQuestion is not a function”:
挂钩出错:类型出错:this.getQuestion 不是一个函数
把方法写在了methods外面,导致出现上面的错误
(2)[Vue warn]: Error in onShow hook: “ReferenceError: http is not defined”
引用出错:未定义定义http
在script里面添加:import http from “../../utils/http”; 。