报错:Now you can provide attr `wx:key` for a `wx:for` to improve performance

报错警告:

原因:

wx:for缺少属性 wx:key的错误

解决:

<view wx:for="{
    
    {arr}}" > {
    
    {item}} </view>

修改为:

<view wx:for="{
    
    {arr}}" wx:key="index"> {
    
    {item}} </view> 

ps:如不提供 wx:key,会报一个 warning, 如果明确知道该列表是静态,或者不必关注其顺序,可以选择忽略。

这只是个警告不是报错,其实也可以忽略。

猜你喜欢

转载自blog.csdn.net/m0_51744718/article/details/128668676