Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react hooks下获取页面参数方法getCurrentInstance与实际在开发者工具上的参数不一致 #7763

Open
PresByter2015 opened this issue Sep 28, 2020 · 1 comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@PresByter2015
Copy link

相关平台

微信小程序

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

复现步骤

在A页面使用 getCurrentInstance获取参数{aid:'111'},然后跳到B页面携带参数{bid:'222'},最后使用Taro.navigateBack({ delta: 1 });方法返回到A页面,这时候在A页面使用getCurrentInstance获取的参数是{bid:'222'},而不是{aid:'111'}。而使用 useRouter() 则不会出现这个情况。

期望结果

getCurrentInstance获取正确的参数。

实际结果

获取的是上一个页面的参数

环境信息

👽 Taro v3.0.9

Babel could not write cache to file: /Users/presbyter/Desktop/dong-project/dongPlusXcx/node_modules/.cache/@babel/register/.babel.7.9.0.development.json 
due to a permission issue. Cache is disabled.

  Taro CLI 3.0.9 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.16.3 - /usr/local/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.9 => 3.0.9 
      @tarojs/mini-runner: 3.0.9 => 3.0.9 
      @tarojs/react: 3.0.9 => 3.0.9 
      @tarojs/runtime: 3.0.9 => 3.0.9 
      @tarojs/taro: 3.0.9 => 3.0.9 
      @tarojs/webpack-runner: 3.0.9 => 3.0.9 
      babel-preset-taro: 3.0.9 => 3.0.9 
      eslint-config-taro: 3.0.9 => 3.0.9 
      react: ^16.10.0 => 16.13.1 
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Sep 28, 2020
@PresByter2015
Copy link
Author

开发者工具和真机偶尔可用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

1 participant