小程序代码警告。求解
发布于 6 年前 作者 weixiang 16432 次浏览 来自 问答

VM3189:2 ./pages/index/index.wxml

(anonymous) @ VM3189:2

VM3189:3  Now you can provide attr “wx:key” for a “wx:for” to improve performance.

  203 |                         </view>

  204 |                         <view class=“goods-list flex-row goods-list-cols-{{cat_goods_cols}}”>

> 205 |                             <view class=“flex-grow-0” wx:for="{{cat.goods_list}}" wx:for-index=“goods_index” wx:for-item=“goods”>

      |                              ^

  206 |                                 <navigator class=“goods-item” url="/pages/goods/goods?id={{goods.id}}">

  207 |                                     <image src="{{goods.pic_url}}" mode=“aspectFill” />

  208 |                                     <text class=“text-more-2 {{cat_goods_cols == 3?‘fs-sm’:’’}}” style=‘padding:0 20rpx;height:2.8em;line-height:1.4;’>{{goods.name}}

(anonymous) @ VM3189:3

2 回复

加个wx:key="",这是警告不是报错,可以选择性无视。

回到顶部