导航栏

使用unvigator传递参数,onLoad接收参数不能使用this,报错undefined

问题

提示变量没有被声明

onLoad:(option)=>{
  不能使用this
}

原因

因为onLoad不是方法中的子方法,而箭头函数中的this会变为父级的this,然而没有父级所以就会显示undefined

解决

onLoad:function(option){
 
}
posted @ 2021-02-18 21:08  RickZ  阅读(92)  评论(0编辑  收藏  举报