From e397edaf942c3c574c5843bd819a6c5f24990637 Mon Sep 17 00:00:00 2001 From: Virya Date: Wed, 26 Aug 2020 14:24:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=96=E6=8B=BD=E8=A1=A8=E6=A0=BC=E6=B8=85?= =?UTF-8?q?=E7=A9=BA=E6=95=B0=E6=8D=AE=E5=90=8E=EF=BC=8C=E5=86=8D=E5=A1=AB?= =?UTF-8?q?=E5=85=85=E6=95=B0=E6=8D=AE=EF=BC=8C=E6=AD=A4=E6=97=B6=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E5=90=8E=EF=BC=8C=E9=A1=B5=E9=9D=A2=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E7=9A=84=E8=A1=A8=E6=A0=BC=E4=B8=8Edata=E4=B8=AD=E7=9A=84list?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E3=80=82=E6=B8=85=E7=A9=BAlist?= =?UTF-8?q?=E5=86=8D=E9=87=8D=E6=96=B0=E8=B5=8B=E5=80=BC=E5=B0=B1=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/table/drag-table.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/views/table/drag-table.vue b/src/views/table/drag-table.vue index 3b5c890..95c3f09 100644 --- a/src/views/table/drag-table.vue +++ b/src/views/table/drag-table.vue @@ -117,8 +117,14 @@ export default { dataTransfer.setData('Text', '') }, onEnd: evt => { - const targetRow = this.list.splice(evt.oldIndex, 1)[0] - this.list.splice(evt.newIndex, 0, targetRow) + let tmpArray = this.list + const targetRow = tmpArray.splice(evt.oldIndex, 1)[0] + + this.list = [] + this.$nextTick(() => { + tmpArray.splice(evt.newIndex, 0, targetRow) + this.list = tmpArray + }) // for show the changes, you can delete in you code const tempIndex = this.newList.splice(evt.oldIndex, 1)[0] -- Gitee