wx:for双循环 里面的循环数据不被更新?

小程序 文章 2021-04-02 09:22 574 0 全屏看文

AI助手支持GPT4.0

wx:for双循环 里面的循环数据不被更新?wx:for double loop The loop data inside is not updated?

wx:for双循环 里面的循环数据不被更新?

arry = [

{ name:123, list:[A,B,C,D,] }

]

<view wx:for=''{{arry }''>

<view wx:for=''{{arry .list}''></view>

</view>


大概是这个意思 arr[0]["list"].push(E) 然后 this.setdata({})

数据是更新成功了. 但是页面arry.list的渲染. 没有被更新. 为什么呢

arry = [ { name:123 , list: [a, B, C, D,]}] < view Wx: for = '{{array}' > < view Wx: for = '{{array. List}' > < / View > < / View > this is probably the meaning of arr [0] [list]. Push (E) and then this.setdata ({}) the data is updated successfully. But the page arry.list The rendering of. Has not been updated. Why

回答:

维她命系:

item.list

brave:
<view wx:for="{{array}}" wx:for-item="item" wx:key="item">  <view wx:for="{{item.list}}" wx:for-item="idx" wx:key="index">{{idx}}</view></view>
祥:
this.setData({  ['arr[0].list']: this.data.arr[0].push('E');});
卢霄霄:哥们,push函数返回的是数组的长度 不是数组本身

-EOF-

AI助手支持GPT4.0