<view class="" wx:for="{{task_time}}" wx:key="index" wx:for-index="idx" style="height: 150rpx; border: black solid 1rpx ;margin:10rpx ; display: flex;flex-direction: column; font-size: 30rpx; " > <view style="height: 140rpx; width: auto; border: black solid 1rpx ;margin:5rpx ; display: flex;flex-direction: row; " > <view style="height: 120rpx; width: 180rpx; border: rgb(204, 12, 12) solid 1rpx ; display: flex;flex-direction: column; margin:5rpx ; " > <view style="text-align:center ; height: 60rpx; "> {{item.time}} </view> <view style="text-align:center ; height: 60rpx;" > {{item.week}} </view> </view> <view wx:for="{{item.month}}" wx:key="_id" style="height: 120rpx; width: auto ; border: black solid 1rpx ;margin:5rpx ; display: flex;flex-direction: row; " > <view data-idx="{{idx}}" data-index="{{index}}" bind:tap="anbeishijian" style="height: 120rpx; width: 180rpx; text-align:center; " class="{{item.bloon == true?'month_1':'month_0'}}" > {{item.month_d}} </view> </view> </view> 难道是这个函数的问题: bind:tap="anbeishijian" 同时触发了3个函数?
更新嵌套数组 目标更新一个结果却更新了一列?数组: 0: {time: "2024-05-20", week: "周一", month: Array(2)} 1: {time: "2024-05-21", week: "周二", month: Array(2)} 2: month: Array(2) 0: {month_d: "8:00-12:00", bloon: false, xiugairen_id: ""} 1: {month_d: "2:00-6:00", bloon: false, xiugairen_id: ""} 更新语言: that.setData({ [`task_time[${idx}].month[${index}].bloon`]:true, }) 或用这种: that.data.task_time[idx].month[index].bloon = true, //已经约定 或请假 that.setData({ task_time:that.data.task_time, }) 打印这俩值都正确: console.log(idx), console.log(index), 更新结果却是都是更新了一列,百思不得其解,请那位高手指点一二
05-17试试 column 我的招就是能想到的全试试, 慢慢就明白了,让童鞋笑话了
wxss设置的 flex-direction: row;为什么无法实现?[图片] [图片] 就是不能横向排布
2022-11-12