code refactoring
This commit is contained in:
parent
84eece8e06
commit
0a6ee522cd
20
resources/assets/js/views/common/documents.js
vendored
20
resources/assets/js/views/common/documents.js
vendored
@ -117,24 +117,14 @@ const app = new Vue({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
checkMove(event) {
|
onEnd() {
|
||||||
debugger;
|
|
||||||
},
|
|
||||||
|
|
||||||
onStart(event) {
|
|
||||||
debugger;
|
|
||||||
},
|
|
||||||
|
|
||||||
onEnd(event, index) {
|
|
||||||
this.drag = false;
|
this.drag = false;
|
||||||
|
|
||||||
let element = this.items[index];
|
|
||||||
this.items.splice(index, 1);
|
|
||||||
this.items.splice(event.newIndex, 0, element);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
log(event) {
|
onUpdate(event) {
|
||||||
debugger;
|
let fromIndex = this.form.items.indexOf(this.form.items[event.oldIndex]);
|
||||||
|
let element = this.form.items.splice(fromIndex, 1)[0];
|
||||||
|
this.form.items.splice(event.newIndex, 0, element);
|
||||||
},
|
},
|
||||||
|
|
||||||
onRefFocus(ref) {
|
onRefFocus(ref) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<tr v-for="(row, index) in items" :index="index">
|
<tbody is="draggable" tag="tbody" handle=".handle" @start="drag = true" @end="drag = false" @update="onUpdate">
|
||||||
|
<tr v-for="(row, index) in items" :index="index">
|
||||||
@stack('name_td_start')
|
@stack('name_td_start')
|
||||||
|
|
||||||
<td class="border-r-0 border-b-0 p-0"
|
<td class="border-r-0 border-b-0 p-0"
|
||||||
@ -19,12 +20,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
@stack('move_td_start')
|
@stack('move_td_start')
|
||||||
<td class="align-middle border-b-0 flex items-center justify-center" style="width:24px; height:100px; color: #8898aa;">
|
<td class="align-middle border-b-0 flex items-center justify-center" style="width:24px; height:100px; color: #8898aa;">
|
||||||
<draggable @change="log" @start="drag = true" @end="onEnd($event, index)" ghost-class="ghost-card">
|
<div class="handle mt-2 hidden lg:block cursor-move">
|
||||||
<div>
|
|
||||||
<span class="w-6 material-icons">list</span>
|
<span class="w-6 material-icons">list</span>
|
||||||
<div v-html="index"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</draggable>
|
|
||||||
</td>
|
</td>
|
||||||
@stack('move_td_end')
|
@stack('move_td_end')
|
||||||
|
|
||||||
@ -428,4 +426,5 @@
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
@stack('name_td_end')
|
@stack('name_td_end')
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user