Commit 7f035c372b892fd3d56b8149ac0e1e797acd9df3
Committed by
GitHub
1 parent
31b4618b
change api name
Showing
1 changed file
with
8 additions
and
9 deletions
Show diff stats
src/components/table/table-tr.vue
1 | 1 | <template> |
2 | - <tr :class="rowClasses(row._index)" :draggable="drag" v-on:dragstart="onDrag($event,row._index)" v-on:drop="onDrop($event,row._index)" v-on:dragover="allowDrop($event)" v-if="drag" ><slot></slot></tr> | |
3 | - <tr :class="rowClasses(row._index)" v-else ><slot></slot></tr> | |
2 | + <tr :class="rowClasses(row._index)" :draggable="draggable" @dragstart="onDrag($event,row._index)" @drop="onDrop($event,row._index)" @dragover="allowDrop($event)" v-if="draggable"><slot></slot></tr> | |
3 | + <tr :class="rowClasses(row._index)" v-else><slot></slot></tr> | |
4 | 4 | </template> |
5 | 5 | <script> |
6 | 6 | export default { |
7 | 7 | props: { |
8 | 8 | row: Object, |
9 | 9 | prefixCls: String, |
10 | - drag:Boolean | |
10 | + draggable: Boolean | |
11 | 11 | }, |
12 | 12 | computed: { |
13 | 13 | objData () { |
... | ... | @@ -15,16 +15,15 @@ |
15 | 15 | } |
16 | 16 | }, |
17 | 17 | methods: { |
18 | - onDrag(e,index){ | |
18 | + onDrag (e,index) { | |
19 | 19 | e.dataTransfer.setData("index",index); |
20 | 20 | }, |
21 | - onDrop(e,index){ | |
22 | - var dragIndex = e.dataTransfer.getData("index"); | |
21 | + onDrop (e,index) { | |
22 | + const dragIndex = e.dataTransfer.getData("index"); | |
23 | 23 | this.$parent.$parent.dragAndDrop(dragIndex,index); |
24 | 24 | e.preventDefault(); |
25 | 25 | }, |
26 | - allowDrop(e) | |
27 | - { | |
26 | + allowDrop (e) { | |
28 | 27 | e.preventDefault(); |
29 | 28 | }, |
30 | 29 | rowClasses (_index) { |
... | ... | @@ -42,4 +41,4 @@ |
42 | 41 | }, |
43 | 42 | } |
44 | 43 | }; |
45 | -</script> | |
46 | 44 | \ No newline at end of file |
45 | +</script> | ... | ... |