1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| test: [ { id: 1, name: 'wangyu', val: '123' }, { id: 2, name: 'mayan', val: '456' } ] chageval(e){ var x = e.currentTarget.dataset.id; console.log(x); var str = "test[" + (x-1) + "].val"; this.setData({ [str]: 'aaa'+x }); }
|