小程式指定更改陣列或物件中的某一個值
阿新 • • 發佈:2019-01-04
1、更改陣列中的值
設 paraList:[{txt:'123',chose:false},{txt:'1234',chose:false}]
let choseChange = "paraList[" + index + "].chose" _this.setData({ [choseChange]: true, numList: numList })可以改變陣列中某一個特定下標的值2、更改物件中的值
userInfo: { // 使用者的驗證資訊 sex: '', name: '', phone: '', code: ''可以單獨更改userInfo中的sex值