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

Taro转百度小程序,组件中使用this.props.children,页面无法显示 #3553

Open
VFiee opened this issue Jun 26, 2019 · 5 comments
Open
Assignees

Comments

@VFiee
Copy link

@VFiee VFiee commented Jun 26, 2019

问题描述
使用Taro文档中Children,无法显示出来https://nervjs.github.io/taro/docs/children.html#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9

复现步骤
[复现问题的步骤]

  1. 编写组件A
  2. 页面B引用组件A,
    Taro Children
3. 百度开发工具运行,无法显示
组件A
renderPropsChildren() {
        return <View>
            {this.props.children}
        </View>
    }
render() {
        return <View>
            {this.renderPropsChildren()}
        </View>
    }
页面B
  <Authorize>
            <View>Taro children</View>
  </Authorize>

期望行为
经过多次尝试,在组件A中如果不使用renderPropsChildren函数渲染,而是直接在render方法中直接return {this.props.children}是可以,但是我需要在renderPropsChildren函数进行逻辑判断渲染。期望在renderPropsChildren中正常渲染(微信小程序没问题)

报错信息
无法显示传入的Children

系统信息
Taro CLI 1.3.4 environment info:
System:
OS: macOS 10.14.5
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.5.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
npmPackages:
@tarojs/async-await: 1.3.4 => 1.3.4
@tarojs/components: 1.3.4 => 1.3.4
@tarojs/plugin-babel: 1.3.4 => 1.3.4
@tarojs/plugin-csso: 1.3.4 => 1.3.4
@tarojs/plugin-less: 1.3.4 => 1.3.4
@tarojs/plugin-uglifyjs: 1.3.4 => 1.3.4
@tarojs/redux: 1.3.4 => 1.3.4
@tarojs/router: 1.3.4 => 1.3.4
@tarojs/taro: 1.3.4 => 1.3.4
@tarojs/taro-alipay: 1.3.4 => 1.3.4
@tarojs/taro-h5: 1.3.4 => 1.3.4
@tarojs/taro-swan: 1.3.4 => 1.3.4
@tarojs/taro-tt: 1.3.4 => 1.3.4
@tarojs/taro-weapp: 1.3.4 => 1.3.4
@tarojs/webpack-runner: 1.3.4 => 1.3.4
eslint-config-taro: 1.3.4 => 1.3.4
eslint-plugin-taro: 1.3.4 => 1.3.4
nerv-devtools: ^1.4.3 => 1.4.3
nervjs: ^1.4.3 => 1.4.3

@taro-bot
Copy link

@taro-bot taro-bot bot commented Jun 26, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@yuche
Copy link
Contributor

@yuche yuche commented Jun 26, 2019

初步怀疑是百度小程序支持在 template 中使用 slot,你可以先把 renderPropsChildren 做成一个独立的组件。

@VFiee
Copy link
Author

@VFiee VFiee commented Jun 26, 2019

初步怀疑是百度小程序支持在 template 中使用 slot,你可以先把 renderPropsChildren 做成一个独立的组件。

百度小程序支持slot,链接https://smartprogram.baidu.com/docs/develop/framework/custom-component_temp/

@VFiee
Copy link
Author

@VFiee VFiee commented Sep 11, 2019

请问一下,有计划兼容renderPropsChildren在百度小程序中的问题么?

@Chen-jj
Copy link
Contributor

@Chen-jj Chen-jj commented Jul 3, 2020

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

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
3 participants
You can’t perform that action at this time.