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

微信小程序偶尔出现页面空白 #4040

Closed
kong-dev opened this issue Aug 1, 2019 · 7 comments
Closed

微信小程序偶尔出现页面空白 #4040

kong-dev opened this issue Aug 1, 2019 · 7 comments
Assignees

Comments

@kong-dev
Copy link
Contributor

kong-dev commented Aug 1, 2019

问题描述
跳转到新页面的时候偶尔出标题已经改为目标页面的标题,但是界面空白,在 constructor 中打日志发现没有执行,返回再次进入就会正常

复现步骤
暂时没有发现稳定的复现步骤

下面是经常出现此问题的其中一个页面的部分代码

/* /pages/me/index.tsx */
export default class Index extends BaseComponent<{}, PageOwnState> {

  config: Config = {
    navigationBarTitleText: '我的'
  }

  private toEnableDevSettings = false
  private lastClickTime = 0
  private devCountdown = DevManager.TAPS_TO_ENABLE_DEVELOPMENT_SETTINGS

  private loaded = false

  static options = {
    addGlobalClass: true
  }

  constructor (props, ...rest) {
    super(props, ...rest)
    console.log('>>>>> me constructor')
    this.state = {
      // initial state
    }
  }

  componentDidMount () {
    super.componentDidMount()
    console.log('componentDidMount')
    // other
  }

  // other
}
/* BaseComponent.tsx */
class BaseComponent<P = {}, S = {}> extends Taro.PureComponent<P, S> {
  static __login_broadcast__ = '__login_broadcast__'
  static systemInfo: Taro.getSystemInfoSync.Return

  constructor (props, ...rest) {
    super(props, ...rest)
    console.warn('>>>>> constructor: ', arguments[1], this.$componentType)
    this.initSystemInfo()
    // other
  }

  componentWillPreload (params: { [p: string]: any }): any {}

  componentWillMount (): void {}

  componentDidMount () {
    let router = this.$router
    console.warn('>>>>> did mount: ', router, this.$componentType)
    // other
  }

  // other
}

期望行为

报错信息
没有发现报错

系统信息
👽 Taro v1.3.10

Taro CLI 1.3.10 environment info:
System:
OS: macOS 10.14.5
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.16.0 - ~/.nvm/versions/node/v10.16.0/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
npmPackages:
@tarojs/async-await: 1.3.9 => 1.3.9
@tarojs/cli: 1.3.9 => 1.3.9
@tarojs/components: 1.3.9 => 1.3.9
@tarojs/plugin-babel: 1.3.9 => 1.3.9
@tarojs/plugin-csso: 1.3.9 => 1.3.9
@tarojs/plugin-sass: 1.3.9 => 1.3.9
@tarojs/plugin-uglifyjs: 1.3.9 => 1.3.9
@tarojs/redux: 1.3.9 => 1.3.9
@tarojs/redux-h5: 1.3.9 => 1.3.9
@tarojs/router: 1.3.9 => 1.3.9
@tarojs/taro: 1.3.9 => 1.3.9
@tarojs/taro-alipay: 1.3.9 => 1.3.9
@tarojs/taro-h5: 1.3.9 => 1.3.9
@tarojs/taro-swan: 1.3.9 => 1.3.9
@tarojs/taro-tt: 1.3.9 => 1.3.9
@tarojs/taro-weapp: 1.3.9 => 1.3.9
@tarojs/webpack-runner: 1.3.9 => 1.3.9
eslint-config-taro: 1.3.9 => 1.3.9
eslint-plugin-taro: 1.3.9 => 1.3.9
nerv-devtools: ^1.4.0 => 1.4.0
nervjs: ^1.4.0 => 1.4.0
stylelint-config-taro-rn: 1.3.9 => 1.3.9
stylelint-taro-rn: 1.3.9 => 1.3.9

补充信息

@taro-bot
Copy link

taro-bot bot commented Aug 1, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@taro-bot
Copy link

taro-bot bot commented Aug 1, 2019

CC @Chen-jj

@shenghanqin
Copy link
Collaborator

1、小程序默认背景颜色是白色,切换时也会出现白色。如果你给页面设置了非白色,那就可能出现颜色不一致的情况。
2、在小程序前进后退期间,小程序渲染不及时,也可能会出现闪白,这个在iPhone手机后退时更毁容发现。
我是把小程序的背景色,page的背景色,当前页面的最大容器的样式,都设置为黑色了,这个问题就没怎么出现了。

@kong-dev
Copy link
Contributor Author

kong-dev commented Aug 2, 2019

1、小程序默认背景颜色是白色,切换时也会出现白色。如果你给页面设置了非白色,那就可能出现颜色不一致的情况。
2、在小程序前进后退期间,小程序渲染不及时,也可能会出现闪白,这个在 iPhone 手机后退时更毁容发现。
我是把小程序的背景色,page 的背景色,当前页面的最大容器的样式,都设置为黑色了,这个问题就没怎么出现了。

可能是我描述不准确,不是页面切换期间的白屏,是切换页面之后目标页面没有加载出来,所以一直停留在白屏的界面

@kong-dev
Copy link
Contributor Author

kong-dev commented Aug 9, 2019

把 BaseComponent 中的 componentWillPreload (params: { [p: string]: any }): any {} 删掉之后就一直没有复现过了,不知是否有关系。

另外关于 componentWillPreload 发现一个问题:#4123 (comment)

@Chen-jj
Copy link
Contributor

Chen-jj commented Aug 15, 2019

@weihandev 复现不了,可以提供相关 demo

@kong-dev
Copy link
Contributor Author

#4040 (comment)
目前一直没有复现

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

No branches or pull requests

4 participants