<t-radio block="{{false}}" checked="{{ item.checked }}" bindchange="changecheck" data-id="{{ item.id }}"/>
// 初始checked=true
changecheck(e){
const id = e.currentTarget.dataset.id;
const checked = e.detail.checked;
const shopcarinfo=wx.getStorageSync('shopcarinfo');
const index = shopcarinfo.findIndex(item => item.id === id);
if (index !== -1) {
shopcarinfo[index].checked = checked;
}
wx.setStorageSync('shopcarinfo', shopcarinfo);
this.getData();
},
这种问题断点调试一下 不就知道了吗
shopcarinfo 是你遍历的值是吧,没看到你给shopcarinfo setData啊
this.getData();
调用了个方法去setData
getData(){
const shopcarinfo = wx.getStorageSync('shopcarinfo');
this.setData({
list: shopcarinfo || []
})
}