解决发布页,关联商品bug,注释watch

This commit is contained in:
cc_zbp 2023-05-15 11:21:16 +08:00
parent d28d897e65
commit b58bf795f8

View File

@ -139,15 +139,13 @@
watch: { watch: {
checkedObj: { checkedObj: {
handler(n) { handler(n) {
this.checkedArr = n // this.checkedArr = n
console.log('watch', this.checkedArr);
}, },
deep: true deep: true
} }
}, },
mounted() { mounted() {
this.checkedArr = this.checkedObj this.checkedArr = this.checkedObj
console.log('mounted', this.checkedArr);
this.getBounht(); this.getBounht();
this.getCollect(); this.getCollect();
this.getBrowse(); this.getBrowse();
@ -288,20 +286,15 @@
/*点击选中与否*/ /*点击选中与否*/
goodsCheck(item, index) { goodsCheck(item, index) {
this.$set(item, 'check', !item.check); this.$set(item, 'check', !item.check);
console.log("Arr", this.checkedArr);
if (item.check) { if (item.check) {
this.checkedArr.push(item) this.checkedArr.push(item)
console.log("增加", this.checkedArr)
} else { } else {
console.log("删除前", this.checkedArr);
this.checkedArr.splice(this.checkedArr.findIndex(itemn => ((itemn.spu_id == item.spu_id) || (item.spu_id == ( this.checkedArr.splice(this.checkedArr.findIndex(itemn => ((itemn.spu_id == item.spu_id) || (item.spu_id == (
itemn.spu && itemn.spu.spu_id)))), 1) itemn.spu && itemn.spu.spu_id)))), 1)
console.log("删除后", this.checkedArr);
} }
}, },
/*确定提交*/ /*确定提交*/
submit() { submit() {
console.log('提交', this.checkedArr);
this.$emit('getProduct', this.checkedArr); this.$emit('getProduct', this.checkedArr);
}, },
} }