setData用变量怎么赋值?
data: {
team:{
p1:{name:"", bg:0, sg:0, checked: 0},
p2:{name:"", bg:0, sg:0, checked: 0},
p3:{name:"", bg:0, sg:0, checked: 0},
p4:{name:"", bg:0, sg:0, checked: 0},
},
switchChange(e) {
let that = this
let id = e.currentTarget.dataset.id
let py = "p1"
let tichu = "bg"
let value = e.detail.value == true ? 1 : 0
that.setData({team.py.tichu:value})
console.log(that.data.team)
// py和tichu是两个字符串,怎么用两个字符串给data.team赋值?