1 //单选 2 select:function(e){ 3 let index = e.currentTarget.dataset.index; 4 staffList = this.staffList; 5 letli = 'staffList [' + index + '] .checked'; 6 this [newli] =!this.staffList [index] .checked; 7 }
上記のコードは、 https://www.cnblogs.com/dreamstartplace/p/12202465.html 関数から取得され ます。
アプレットでの割り当ては this.setData({[newli] =!This.staffList [index] .checked}) であるため、プロジェクトの変更により、コードはwepyフレームワークに配置する必要があり、データはwepyで動的に変更されますsetDataの代わりに、値を割り当てるだけですが、これではなく、 この[newli] に 注意を払う必要があり ます[Newli] (中央に「。」がないことを確認してください)。