Commit a1c9188b authored by xieyishang's avatar xieyishang

处理规格~

parent 9aac71ca
......@@ -37,7 +37,8 @@
],
//myischildlist:[],//存储选中的状态
//这里坑了 先这样写 赶时间
chindisarr:[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
chindisarr:[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
isswitch:true,
}
},
computed:{
......@@ -45,42 +46,61 @@
},
methods:{
tapInfo(item,index) {
console.info(item,index);
if (this.chindisarr[index] == false) {//没选 就选
//console.log(e)//打印下标
this.rSelect.push(item);//选中添加到数组里
this.isdataarr.push(item);//选中的数据 真实的 {name:this.chinddata.spec_item[key],id:key}
// let chinddata = this.chinddata;
// chinddata.spec_item[index].ischild = true;
//设置开关 防止点击过快
if(this.isswitch==true){
this.isswitch = false;
//this.chindisarr[index] = true;
this.$set(this.chindisarr, index, true);
//this.$emit("changeSpecList",{data:chinddata,index:this.isindex,specList_item_id:this.chinddata.id});
if (this.chindisarr[index] == false) {//没选 就选
this.rSelect.push(item);//选中添加到数组里
this.isdataarr.push(item);//选中的数据 真实的 {name:this.chinddata.spec_item[key],id:key}
// let chinddata = this.chinddata;
// chinddata.spec_item[index].ischild = true;
//this.chindisarr[index] = true;
this.$set(this.chindisarr, index, true);
//this.$emit("changeSpecList",{data:chinddata,index:this.isindex,specList_item_id:this.chinddata.id});
} else {
this.rSelect.splice(index, 1); //取消
this.isdataarr.splice(index, 1);
//this.chindisarr[index] = false;
this.$set(this.chindisarr, index, false);
// let chinddata = this.chinddata;
// chinddata.spec_item[index].ischild = false;
// this.$emit("changeSpecList",{data:chinddata,index:this.isindex,specList_item_id:this.chinddata.id});
}
} else {
this.rSelect.splice(index, 1); //取消
console.info("isindex",this.isindex);
//把选中的值传回去
this.isdataarr.splice(index, 1);
//this.chindisarr[index] = false;
let chlist = [];
//重新筛选一份选中的类别 之前的有误差
this.chinddata.spec_item.forEach((item,index)=>{
if(this.chindisarr[index]==true){
chlist.push(item);
}
})
this.$set(this.chindisarr, index, false);
//this.isdataarr
this.isswitch = true;//打开开关
this.$emit("changecheckbox",{indexsz:this.isindex,child:chlist,specList_item_id:this.chinddata.id});
// let chinddata = this.chinddata;
// chinddata.spec_item[index].ischild = false;
// this.$emit("changeSpecList",{data:chinddata,index:this.isindex,specList_item_id:this.chinddata.id});
}
console.info("isindex",this.isindex);
//把选中的值传回去
this.$emit("changecheckbox",{indexsz:this.isindex,child:this.isdataarr,specList_item_id:this.chinddata.id});
}
},
onLoad() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment