Browse Source

bug 修复

lilei 4 năm trước cách đây
mục cha
commit
8d5fe6d03b

+ 3 - 1
components/uni-check-list/uni-check-list.vue

@@ -92,12 +92,14 @@ export default {
 				let a = this.value.findIndex(k=>{
 				let a = this.value.findIndex(k=>{
 					return this.backValue == 'idArr' ? k == item.id : k.id == item.id
 					return this.backValue == 'idArr' ? k == item.id : k.id == item.id
 				})
 				})
+				console.log(this.value,a)
 				item.checked = a>=0
 				item.checked = a>=0
 			})
 			})
 			this.list.splice()
 			this.list.splice()
 		},
 		},
 		// 选中
 		// 选中
 		chooseItem(item) {
 		chooseItem(item) {
+			console.log(item,'=========')
 			// 单选
 			// 单选
 			if (this.types == 'radio') {
 			if (this.types == 'radio') {
 				this.value[0] = this.backValue == 'idArr' ? item.id : item;
 				this.value[0] = this.backValue == 'idArr' ? item.id : item;
@@ -105,7 +107,7 @@ export default {
 			} else {
 			} else {
 				// 取消选中
 				// 取消选中
 				if (item.checked) {
 				if (item.checked) {
-					let index = this.value.indexOf(item.id);
+					let index = this.backValue == 'idArr' ? this.value.indexOf(item.id) : this.value.findIndex(a=> a.id == item.id);
 					this.value.splice(index, 1);
 					this.value.splice(index, 1);
 				} else {
 				} else {
 					this.value.push(this.backValue == 'idArr' ? item.id : item);
 					this.value.push(this.backValue == 'idArr' ? item.id : item);