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

maps 三目运算解析,key 的位置错误 #199

Closed
zacksleo opened this issue Jun 25, 2018 · 0 comments
Closed

maps 三目运算解析,key 的位置错误 #199

zacksleo opened this issue Jun 25, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@zacksleo
Copy link
Contributor

zacksleo commented Jun 25, 2018

return this.state.list[activeIndex].type === 'trip' ?
  (
    <Navigator
      key={index}
      className="boutique_con"
      hoverclass="none"
      url="/pages/trip/view/index?id={item.id}"
    >
    <View>1</View>
    </Navigator>
  ) : (
    <Navigator
      key={item.id}
      className="boutique_con"
      hoverclassName="none"
      url="/pages/visa/view/index?id={item.id}"
    >
    <View>2</View>
    </Navigator>
  );

解析后,key 出现在了子元素中

<block wx:for="{{list[activeIndex].list}}" wx:for-item="item" wx:for-index="index">
    <block wx:if="{{list[activeIndex].type === 'trip'}}">
        <navigator wx:key="{{index}}" class="boutique_con" hoverclass="none" url="/pages/trip/view/index?id={item.id}">
            <view>1</view>
        </navigator>
    </block>
    <block wx:else>
        <navigator wx:key="{{item.id}}" class="boutique_con" hoverclass-name="none"
        url="/pages/visa/view/index?id={item.id}">
            <view>2</view>
        </navigator>
    </block>
</block>
@yuche yuche added the bug Something isn't working label Jun 26, 2018
@yuche yuche closed this as completed in 6e24fcc Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants