- 当前 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这个属性,请问为什么,如果存在兼容性问题,有其他的解决方案吗
getCurrentPages()[0]['__displayReporter'].showReferpagepath
看看这样行不
你打印getCurrentPages(),你不是要判断当前页面是不是你指定的页面吗,我记得getCurrentPages()有路径这些参数可以给你判断的。
getCurrentPage()[0].route === 'pages/Home/index'
上级路由不也是这样的吗,首先判断当前页面栈个数,是否存在上级页面,然后把页面栈的个数减一不就上级页面栈了么
getCurrentPage()[getCurrentPage().length - 1].route