radio-group为什么setData的值改变了,动态绑定到WXML的class却没起作用?
Page({
data: {
goods: {
images: [
'../../assets/images/arrival1.png',
'../../assets/images/arrival1.png'
],
items: [
{ value: 'USA', name: '美国' },
{ value: 'CHN', name: '中国', checked: true },
{ value: 'BRA', name: '巴西' }
]
}
},
radioChange: function (e) {
// console.log('value值为:', e.detail.value)
let items = this.data.goods.items
items.forEach((item) => (
item.checked = item.value === e.detail.value
// console.log(item)
))
this.setData({ items })
}
})
[图片] [图片]https://developers.weixin.qq.com/s/mBcxnHmz7RBN