为什么我设置了wx:key,input框在for循环下还是重新渲染了
发布于 6 年前 作者 ocao 10896 次浏览 来自 问答

为什么我设置了wx:key,input框在for循环下还是重新渲染了

<input value=“id:{{item.test}}”   wx:for="{{testarr}}"   wx:key=test />

1 回复

如果你想要避免testarr列表内的元素被重新渲染可以用

this.setData({[`testarr[${index}]`]: update})
回到顶部