在nuxt 自定义的index 页面下,想要在mounted 的时候,调用一个方法,但是一直显示 this.handleGame is not a functio
目录层级:
|--page
|--game
|-- _id
|--index.vue
<script>
export default {
async asyncData(context) {
const apiGame = await context.app.api.getGameList();
const gameInfo = context.params.id;
return { gameInfo, apiGame }
},
data() {
return {
imgSrc: [],
}
},
mounted () {
Promise.resolve()
.then(() => this.handleGame())
.catch(e => {
this.$message({
showClose: true,
message: "加载过程中出现错误",
type: "error"
});
console.error("加载过程中出现错误:", e);
});
},
method: {
handleGame(){
console.log('getGame----222222')
}
}
}
</script>然后就报错,显示 _this.handleGame is not a function,一直不明白是什么原因。
请教各位大神,这是什么原因,该如何解决。先谢谢各位了!!!
写错了 是
methods