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

小程序开发-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>

猜你喜欢

转载自www.cnblogs.com/xpwi/p/9878871.html