|
@@ -32,15 +32,19 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
radioSetting:function(e){
|
|
|
- var occupations = this.data.occupations;
|
|
|
- var index = e.currentTarget.dataset.index;
|
|
|
- var arr = occupations.filter(item => {
|
|
|
- if (item.status){
|
|
|
- return item.checked = true;
|
|
|
+ let occupations = this.data.occupations;
|
|
|
+ let index = e.currentTarget.dataset.index;
|
|
|
+ for (let i = 0; i < occupations.length;i++){
|
|
|
+ let state = index;//缓存 用户当前点击的索引。
|
|
|
+ if (occupations[state].checked){
|
|
|
+ occupations[state].checked = false;
|
|
|
}
|
|
|
- });
|
|
|
+ else{
|
|
|
+ occupations[state].checked = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
this.setData({
|
|
|
- occupations: arr
|
|
|
+ occupations: occupations
|
|
|
});
|
|
|
console.log(occupations);
|
|
|
},
|