报错: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

@[toc]

问题

在小程序开发时出现缺少wx:key的错误

报错

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

在这里插入图片描述

解决办法

在使用wx:for遍历的时候,未绑定key值
绑定 方法:wx:key="index"wx:key="this"

<!--wxml-->
<view wx:for="{
    
    {array}}" wx:key="index"> {
    
    {
    
    index}}-{
    
    {
    
    item}}</view>
// page.js
Page({
   
   
  data: {
   
   
    array: [1, 2, 3, 4, 5]
  }
})
相关文章
|
9月前
Each child in a list should have a unique “key“ prop. Check the render method的报错解决
Each child in a list should have a unique “key“ prop. Check the render method的报错解决
|
9月前
(145) Table ‘./addon_collect_wukong_spider‘ is marked as crashed and should be repaired解决思路
(145) Table ‘./addon_collect_wukong_spider‘ is marked as crashed and should be repaired解决思路
35 0
Unknown custom element: <add-employee> - did you register the component correctly? For red cursive c
原因: 1.组件名没写对(导入和注册不对应) 2.components少写了个s 3.组件命名最好是驼峰命名 4.导入时语法错误 5.代码中有两个components,后一个的值把前一个覆盖了 6.组件直接循环套用了
111 0
Error:express-session deprecated undefined resave option; provide resave option app.js:17:10
Error:express-session deprecated undefined resave option; provide resave option app.js:17:10
Error:express-session deprecated undefined resave option; provide resave option app.js:17:10
|
Rust 小程序
小程序警告:Now you can provide attr wxkey for a wxfor to improve performance
首先,无论什么程序,控制台中的警告都是会影响程序性能的。我们需要减少此类警告的出现,以提高程序的运行性能。 小程序开发的时候,遇到了如下的警告:
203 0
|
小程序
微信小程序:Error: Behaviors should be constructed with Behavior()
微信小程序:Error: Behaviors should be constructed with Behavior()
763 0
|
小程序
小程序警告: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.
4815 0
Cannot find source code based button in SE24
When you are logging on to customer system for incident handling, you want to switch to source code to perform some keyword search. However, you could not find button “Source code based builder” in toolbar, with following warning message: ———————————————— 版权声明:本文为CSDN博主「汪子熙」的原创文章,遵循CC 4.0 BY-SA版权协
Cannot find source code based button in SE24
成功解决AttributeError: 'MapDataset' object has no attribute 'group_by_window'
成功解决AttributeError: 'MapDataset' object has no attribute 'group_by_window'
成功解决AttributeError: 'MapDataset' object has no attribute 'group_by_window'
Unable to add window --token is not valid
Unable to add window --token is not valid