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内子组件传参问题 #339

Closed
Sdoy opened this issue Jul 17, 2018 · 2 comments
Closed

map内子组件传参问题 #339

Sdoy opened this issue Jul 17, 2018 · 2 comments

Comments

@Sdoy
Copy link

Sdoy commented Jul 17, 2018

问题描述
直接看代码吧

{
        products.map((product,index)=>{
          console.log(`isLastItem----`,(index + 1 )=== products.length)
          return <ProductCell product={product} key={index}  islast={(index + 1 )=== products.length} />
        })
      }

然后在ProductCell组件内输出this.props;
image

行吧,换个写法

{
        products.map((product,index)=>{
          console.log(`isLastItem----`,(index + 1 )=== products.length)
          const isLast=(index + 1 )=== products.length;
          return isLast?<ProductCell product={product} key={index}  islast />:<ProductCell product={product} key={index}  islast={false} />
        })
      }

结果:
image
这应该是同一个cell先被赋值了true后被赋值了false

系统信息

  • 操作系统: mac
  • Taro 版本 0.0.69
  • Node.js 版本 8.5
@luckyadam
Copy link
Member

恩,是组件化的问题,正在重构,本周修改完成

@luckyadam
Copy link
Member

最新的 beta 版本已经修复了这个问题

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