Skip to content

Commit fc9e724

Browse files
authored
fix[DragTable]: support multiple drag-table (#1666)
1 parent 9677406 commit fc9e724

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/views/table/dragTable.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="app-container">
33
<!-- Note that row-key is necessary to get a correct row order. -->
4-
<el-table v-loading="listLoading" :data="list" row-key="id" border fit highlight-current-row style="width: 100%">
4+
<el-table v-loading="listLoading" ref="dragTable" :data="list" row-key="id" border fit highlight-current-row style="width: 100%">
55

66
<el-table-column align="center" label="ID" width="65">
77
<template slot-scope="scope">
@@ -107,7 +107,7 @@ export default {
107107
})
108108
},
109109
setSort() {
110-
const el = document.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
110+
const el = this.$refs.dragTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
111111
this.sortable = Sortable.create(el, {
112112
ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
113113
setData: function(dataTransfer) {

0 commit comments

Comments
 (0)