小程序路由栈报错

发布于 6 年前作者 mengyang11447 次浏览最后编辑 6 年前来自 ask
  • 当前 Bug 的表现(可附上截图)

  • 预期表现

  • 复现路径

  • 提供一个最简复现 Demo

if (getCurrentPages()[0].__displayReporter.showReferpagepath != ‘pages/lesson/detail/index.html’) {

this.onLoad()

}

想判断上级路由是不是‘pages/lesson/detail/index.html’,然后线上的右报错“Cannot read property ‘showReferpagepath’ of undefined;at “pages/lesson/index” page lifeCycleMethod onShow function“


找不到__displayReporter这个属性,请问为什么,如果存在兼容性问题,有其他的解决方案吗

1 回复
juancao
juancao1 楼5 年前

getCurrentPages()[0][‘__displayReporter’].showReferpagepath

看看这样行不