请求navigateBack后,回调的sucees方法中继续请求Taro.getCurrentPages(),获取到的信息是旧的

vxf3dgd4  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(36)

相关平台

微信小程序

小程序基础库: 3.3.3
使用框架: React

复现步骤

Taro.navigateBack({
delta: 1,
success: () => {
console.info(Taro.getCurrentPages());
}
});

期望结果

返回navigateBack后的页面信息

实际结果

返回了navigateBack前的页面信息

环境信息

👽 Taro v3.6.15

  Taro CLI 3.6.15 environment info:
    System:
      OS: Windows 10 10.0.19044
    Binaries:
      Node: 18.16.0 - E:\Z-Envir\Nvm\nodejs\node.EXE
      Yarn: 1.22.19 - E:\Z-Envir\Nvm\nodejs\yarn.CMD
      npm: 9.5.1 - E:\Z-Envir\Nvm\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.22 => 3.6.22
      @tarojs/components: 3.6.22 => 3.6.22
      @tarojs/helper: 3.6.22 => 3.6.22
      @tarojs/plugin-framework-react: 3.6.22 => 3.6.22
      @tarojs/plugin-platform-alipay: 3.6.22 => 3.6.22
      @tarojs/plugin-platform-h5: 3.6.22 => 3.6.22
      @tarojs/plugin-platform-jd: 3.6.22 => 3.6.22
      @tarojs/plugin-platform-qq: 3.6.22 => 3.6.22
      @tarojs/plugin-platform-swan: 3.6.22 => 3.6.22
      @tarojs/plugin-platform-tt: 3.6.22 => 3.6.22
      @tarojs/plugin-platform-weapp: 3.6.22 => 3.6.22
      @tarojs/react: 3.6.22 => 3.6.22
      @tarojs/runtime: 3.6.22 => 3.6.22
      @tarojs/shared: 3.6.22 => 3.6.22
      @tarojs/taro: 3.6.22 => 3.6.22
      @tarojs/taro-loader: 3.6.22 => 3.6.22
      @tarojs/webpack5-runner: 3.6.22 => 3.6.22
      babel-preset-taro: 3.6.22 => 3.6.22
      eslint-config-taro: 3.6.22 => 3.6.22
      react: ^18.0.0 => 18.2.0
bkhjykvo

bkhjykvo1#

遇到同样的问题了,back后,在旧页面onshow时 getCurrentPages 是正确的。但是getCurrentInstance要延时获取才会正确

相关问题