美文网首页
Now you can provide attr "wx:key

Now you can provide attr "wx:key

作者: a6217200e10d | 来源:发表于2018-11-14 15:17 被阅读0次

Now you can provide attr "wx:key" for a "wx:for" to improve performance.

现在你可以为 "wx:for"  添加 "wx:key" 属性,来提高性能。

其实也提高了可读性。

不然的话,我看代码的时候就在想,哪里来 item,一脸蒙逼。

<view wx:for="{{building}}" wx:key="item" class="item-container">

    <view class="items">

        <view class="left">

            <view class="msg">{{item.name}}</view>

            <view class="time">{{item.region}}</view>

        </view>

        <view class="right">{{item.tag}}</view>

    </view>

</view>

本文地址:https://www.jianshu.com/p/a0f22bd2699c

相关文章

网友评论

      本文标题:Now you can provide attr "wx:key

      本文链接:https://www.haomeiwen.com/subject/horjfqtx.html