插件使用getCurrentPages()可以获取小程序页面栈吗?

小程序 文章 2020-08-12 19:21 895 0 全屏看文

AI助手支持GPT4.0

插件使用getCurrentPages()可以获取小程序页面栈吗?Can the plugin use getCurrentPages() to get the applet page stack?

插件使用getCurrentPages()可以获取小程序页面栈吗?

小程序页面中引入了插件中的自定义组件

插件中的自定义组件使用 navigator>方式跳转到插件页面

此时在插件页面使用getCurrentPages()获取页面栈时,返回的数组第一项是null,第二项是当前的插件页

大神们能帮忙看下为什么返回的数组第一项是null吗?是插件页面获取的页面栈不支持小程序页面吗?


The custom component in the plug-in is introduced in the applet page. The custom component in the plug-in uses navigator > to jump to the plug-in page. At this time, when the plug-in page uses getcurrentpages() to get the page stack, the first item of the returned array is null, and the second item is the current plug-in page. Can you help us see why the first item of the returned array is null? Is the page stack obtained by plug-in pages not supporting applet pages?

回答:

Hoo:

感觉这个是插件和小程序之间页面栈的区分问题呢,是不是插件中就是拿不到小程序页面的页面栈呢?

手动@官方,帮忙回答下呗~

圣殿骑士:

看你需要返回几层,还是怎么跳转进去的

如果仅仅是要返回前一页,其实没必要获取路由

直接用 wx.navigateBack 就行了。

第一个没有。。。说明你首页设置有问题,或者进去的方式有问题


Hoo:获取页面栈是因为在返回上一页的时候需要传一些参数过去
拾忆:

在小程序那个阶段打印的 getCurrentPages()

Hoo:是在点击一个按钮之后点击的
Hoo:是在点击一个按钮之后打印的
拾忆:在当前也买你的 onload   log一下 getCurrentPages() 保存this.data.xxx,然后在点击时调用
拾忆:在当前页面 onload log一下 getCurrentPages() 然后 保存this.data.xxx,然后在点击时调用
Hoo:在当前插件页的onLoad中打印的结果和上面一样
拾忆:切换一下基础库,看一下,有没有差别
Hoo:没有差别呢(大哭)

-EOF-

AI助手支持GPT4.0