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

百度小程序组件ref在真机上是undefined,在百度开发者工具上与微信小程序结果不一样 #5609

Closed
1ifeng opened this issue Mar 4, 2020 · 3 comments
Assignees

Comments

@1ifeng
Copy link

1ifeng commented Mar 4, 2020

问题描述

这个问题之前在这个issue上已经讨论过#2631 ,但是真机上还是有问题,this.modal打印出来是undefined,并且在百度开发者工具上看,子组件存在,但是组件的方法还是undefined,要用this.modal.$component.show()这个写法,而不是直接用this.modal.show()

// JSX
<Modal ref={this.refModal} />
// 调用
refModal = node => this.modal = node

onModalClick() {
  console.log(this.modal)
}

期望行为

与微信小程序一样的结果

报错信息

系统信息

手机信息
iPhone 11, ios 13.3.1
手机百度版本
11.19.0.18
Taro版本:
Taro v2.0.5

Taro CLI 2.0.5 environment info:
System:
OS: macOS 10.15.3
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.15.1 - /usr/local/bin/node
Yarn: 1.16.0 - ~/.yarn/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
npmPackages:
@tarojs/components: 2.0.5 => 2.0.5
@tarojs/components-qa: 2.0.5 => 2.0.5
@tarojs/mini-runner: 2.0.5 => 2.0.5
@tarojs/redux: 2.0.5 => 2.0.5
@tarojs/redux-h5: 2.0.5 => 2.0.5
@tarojs/router: 2.0.5 => 2.0.5
@tarojs/taro: 2.0.5 => 2.0.5
@tarojs/taro-alipay: 2.0.5 => 2.0.5
@tarojs/taro-h5: 2.0.5 => 2.0.5
@tarojs/taro-qq: 2.0.5 => 2.0.5
@tarojs/taro-quickapp: 2.0.5 => 2.0.5
@tarojs/taro-rn: 2.0.5 => 2.0.5
@tarojs/taro-swan: 2.0.5 => 2.0.5
@tarojs/taro-tt: 2.0.5 => 2.0.5
@tarojs/taro-weapp: 2.0.5 => 2.0.5
@tarojs/webpack-runner: 2.0.5 => 2.0.5
eslint-config-taro: 2.0.5 => 2.0.5
eslint-plugin-taro: 2.0.5 => 2.0.5
nerv-devtools: ^1.5.6 => 1.5.6
nervjs: ^1.5.6 => 1.5.6
stylelint-config-taro-rn: 2.0.5 => 2.0.5
stylelint-taro-rn: 2.0.5 => 2.0.5
npmGlobalPackages:
typescript: 3.3.3

补充信息

微信小程序和支付宝小程序在开发者工具和真机上保持一致

@taro-bot
Copy link

taro-bot bot commented Mar 4, 2020

CC @Chen-jj

@taro-bot
Copy link

taro-bot bot commented Mar 4, 2020

欢迎提交 Issue~

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

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

Good luck and happy coding~

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 3, 2020

Taro 3 应该没有这个问题了。

@Chen-jj Chen-jj closed this as completed Jul 3, 2020
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

2 participants