From 41ba57282d85f6e395a23bfee64500bcf192f009 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 16 Jan 2019 10:14:58 +0800 Subject: [PATCH] fix[DndList]: fixed drag bug #1524 --- src/components/DndList/index.vue | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/components/DndList/index.vue b/src/components/DndList/index.vue index 43e0bb28..da4afb82 100644 --- a/src/components/DndList/index.vue +++ b/src/components/DndList/index.vue @@ -4,7 +4,7 @@

{{ list1Title }}

-
[{{ element.author }}] {{ element.title }}
+
{{ element.id }}[{{ element.author }}] {{ element.title }}
@@ -15,9 +15,9 @@

{{ list2Title }}

- -
-
[{{ element.author }}] {{ element.title }}
+ +
+
{{ element.id }} [{{ element.author }}] {{ element.title }}
@@ -60,16 +60,6 @@ export default { default: '48%' } }, - computed: { - filterList2() { - return this.list2.filter(v => { - if (this.isNotInList1(v)) { - return v - } - return false - }) - } - }, methods: { isNotInList1(v) { return this.list1.every(k => v.id !== k.id) @@ -90,7 +80,9 @@ export default { } }, pushEle(ele) { - this.list1.push(ele) + if (this.isNotInList1(ele)) { + this.list1.push(ele) + } } } }