close
The Wayback Machine - https://web.archive.org/web/20200703103517/https://github.com/NervJS/taro/issues/6132
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

百度基础库版本较低时页面报错白屏 #6132

Open
eriklynd opened this issue Apr 27, 2020 · 6 comments
Open

百度基础库版本较低时页面报错白屏 #6132

eriklynd opened this issue Apr 27, 2020 · 6 comments
Assignees

Comments

@eriklynd
Copy link

@eriklynd eriklynd commented Apr 27, 2020

问题描述

百度在基础库3.70.x改动了生命周期,并在后面一些版本有回退。Taro的页面在使用旧生命周期的基础库上运行报错,页面白屏。

复现步骤

  1. 将任意Taro项目编译到百度
  2. 在IDE中打开,选择基础库版本3.80.34
  3. 查看控制台有报错,页面白屏

期望行为

页面无兼容性问题,在新/旧生命周期的基础库环境下,都可以正常展示

报错信息

TypeError: Cannot read property '$router' of undefined
    at Object.weappComponentConf.methods.onLoad (taro.js:1258)
    at f (index.js:1)
    at Object.<anonymous> (index.js:1)
    at Object._onReady (index.js:1)
    at Object.rendered (index.js:1)
    at e.value (index.js:1)
    at e.value (index.js:1)
    at index.js:1
    at Array.forEach (<anonymous>)
    at t.slaveCommunicator.onMessage.listenPreviousEvent (index.js:1)

系统信息

Taro CLI 2.1.5 environment info:
    System:
      OS: macOS 10.15.4
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
      Yarn: 1.22.4 - /usr/local/bin/yarn
      npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
    npmPackages:
      @tarojs/cli: 2.1.5 => 2.1.5
      @tarojs/components: 2.1.5 => 2.1.5
      @tarojs/components-qa: 2.1.5 => 2.1.5
      @tarojs/mini-runner: 2.1.5 => 2.1.5
      @tarojs/plugin-babel: 2.1.5 => 2.1.5
      @tarojs/plugin-csso: 2.1.5 => 2.1.5
      @tarojs/plugin-sass: 2.1.5 => 2.1.5
      @tarojs/plugin-uglifyjs: 2.1.5 => 2.1.5
      @tarojs/redux: 2.1.5 => 2.1.5
      @tarojs/redux-h5: 2.1.5 => 2.1.5
      @tarojs/router: 2.1.5 => 2.1.5
      @tarojs/taro: 2.1.5 => 2.1.5
      @tarojs/taro-alipay: 2.1.5 => 2.1.5
      @tarojs/taro-h5: 2.1.5 => 2.1.5
      @tarojs/taro-qq: 2.1.5 => 2.1.5
      @tarojs/taro-quickapp: 2.1.5 => 2.1.5
      @tarojs/taro-rn: 2.1.5 => 2.1.5
      @tarojs/taro-swan: 2.1.5 => 2.1.5
      @tarojs/taro-tt: 2.1.5 => 2.1.5
      @tarojs/taro-weapp: 2.1.5 => 2.1.5
      @tarojs/webpack-runner: 2.1.5 => 2.1.5
      eslint-config-taro: 2.1.5 => 2.1.5
      eslint-plugin-taro: 2.1.5 => 2.1.5
      nerv-devtools: ^1.5.6 => 1.5.6
      nervjs: ^1.5.6 => 1.5.6
      stylelint-config-taro-rn: 2.1.5 => 2.1.5
      stylelint-taro-rn: 2.1.5 => 2.1.5

补充信息

关于百度生命周期更改的公告: https://smartprogram.baidu.com/forum/topic/show/70128

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

@taro-bot taro-bot bot commented Apr 27, 2020

@taro-bot
Copy link

@taro-bot taro-bot bot commented Apr 27, 2020

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Chen-jj
Copy link
Contributor

@Chen-jj Chen-jj commented Apr 27, 2020

@eriklynd Taro 在 2.0.6、1.3.36 照百度新生命周期重构了 ref 系统,兼容旧生命周期的话只能使用这两个版本前的 Taro 了。

@eriklynd
Copy link
Author

@eriklynd eriklynd commented Apr 27, 2020

@Chen-jj 那重构之后的ref系统,能否兼容一下旧的生命周期呢?新的bugfix不会在老版本上,使用老版本也会遇到其他问题

@Chen-jj
Copy link
Contributor

@Chen-jj Chen-jj commented Apr 28, 2020

@eriklynd 当时改动太大没有兼容。设置一下基础库最低版本?
image

@eriklynd
Copy link
Author

@eriklynd eriklynd commented Apr 28, 2020

@Chen-jj 基础库版本现在发现3.80.34有回退bug,还是旧的生命周期,所以要升级基础库版本至少要到3.90.25。这个影响还是有点大…不好兼容的话我再具体看下升级方案吧。多谢解答。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.