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 函数里面,子组件无法正常使用 #382

Closed
jimczj opened this issue Jul 25, 2018 · 3 comments
Closed

map 函数里面,子组件无法正常使用 #382

jimczj opened this issue Jul 25, 2018 · 3 comments

Comments

@jimczj
Copy link
Contributor

jimczj commented Jul 25, 2018

问题描述
render 函数中,使用jsx进行map,组件使用错误

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

render () {
    const { tabList, current, color } = this.props
    const style = `color: ${color};border-bottom: 1px solid ${color};`
    return <View className='at-tab-bar'>
      {
        tabList.map((item, i) => <View className='at-tab-bar__item' style={current === i ? style : ''} key={item} onClick={this.handleClick.bind(this, i)}>
          <View className='at-tab-bar__icon' ><AtIcon value='computer' color={color} /></View>
          <View className='at-tab-bar__title'>{item.title}</View>
        </View>)
      }
    </View>
  }

AtIcon 是自己定义的一个组件,在map函数外面能正常使用如图1,在map函数里面无法正常调用如图2

图1:
image

图2:
image

期望行为
在map中能正常使用组件

报错信息

image
props 无法传递过去

系统信息

  • 操作系统: [mac 10.13.3]
  • Taro 版本 [v.0.0.70]
  • Node.js 版本 [v10.0.0]

补充信息
map 时 props 无法传递

@gigizhaoo
Copy link

有同样的困惑

@luckyadam
Copy link
Member

#389
目前提供了新的组件化版本,升级到 1.0.0-beta.1 试试~

@stale
Copy link

stale bot commented Oct 24, 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