转自:https://www.cnblogs.com/xpwi/p/9878871.html

小程序开发-Now you can provide attr "wx:key" for a "wx:for" to improve performance

当我们开发微信小程序用到"wx:for"时可能会在控制台报"Now you can provide attr "wx:key" for a "wx:for" to improve performance"警告

不要慌张这只是警告不妨碍运行,消除警告只需要在"wx:for"后面添加wx:key="xxx" 就行了,例如这样:

<block wx:for="{{imgUrls}}" wx:key="">
      <swiper-item>
        <image src="{{item}}" class='lfsc-topimg' />
      </swiper-item>
</block>
posted on 2019-01-24 01:00  Sharpest  阅读(268)  评论(0编辑  收藏  举报