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

数组map返回自定义组件,自定义组件拿不到props传入的值。 #544

Closed
JieSwift opened this issue Aug 29, 2018 · 5 comments
Closed

Comments

@JieSwift
Copy link

问题描述
数组map自定义组件,自定义组件拿不到props传入的值。

复现步骤

 <Tabs
          tabs={navs}
          tabsNavClass="tabs-nav-bear"
          activeKey={active}
          onChange={this.onTabChange.bind(this)}
        >
          {loading['homeModel/getBricks'] ? (
            <Loading center />
          ) : (
            bricks.map(_ => (
              <View
                className={cn('home-tabs-content', {
                  active: _.key === active,
                })}
                key={_.key}
              >
             // 组件Bricks拿不到传入的list的值
                <Bricks list={_.brick.bricks} />
              </View>
            ))
          )}
 </Tabs>

期望行为
数组map能拿到自定义组件传入props的值。

系统信息

  • 操作系统: [e.g. mac]
  • Taro 版本 [e.g. v1.0.0-beta.18]
  • Node.js 版本 [e.g. v8.11.3]
@luckyadam
Copy link
Member

luckyadam commented Aug 29, 2018

list 在 <Bricks /> 组件里有用到么

@JieSwift
Copy link
Author

有用到。

//Bricks
render() {
    const { list = [] } = this.props;
    console.log('list', list);
    return (
      <View className="bricks-component">
        {list.map((_, i) => (
          <View key={i}>{_.recommend_search}</View>
        ))}
      </View>
    );
  }

@JieSwift
Copy link
Author

没人解决么?比较急的一个需求。

@Simbachen
Copy link
Contributor

有没有更多的信息,我没有复现这个问题,尝试一下升级到最新的版本试试~

@stale
Copy link

stale bot commented Oct 30, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

3 participants