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

问题

提示变量没有被声明

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

原因

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

解决

onLoad:function(option){
 
}
原文地址:https://www.cnblogs.com/psyduck/p/14413495.html