code refactoring

This commit is contained in:
Burak Civan 2022-12-23 13:44:14 +03:00
parent 84eece8e06
commit 0a6ee522cd
2 changed files with 373 additions and 384 deletions

View File

@ -117,24 +117,14 @@ const app = new Vue({
},
methods: {
checkMove(event) {
debugger;
},
onStart(event) {
debugger;
},
onEnd(event, index) {
onEnd() {
this.drag = false;
let element = this.items[index];
this.items.splice(index, 1);
this.items.splice(event.newIndex, 0, element);
},
log(event) {
debugger;
onUpdate(event) {
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) {

View File

@ -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')
<td class="border-r-0 border-b-0 p-0"
@ -19,12 +20,9 @@
<tr>
@stack('move_td_start')
<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>
<div class="handle mt-2 hidden lg:block cursor-move">
<span class="w-6 material-icons">list</span>
<div v-html="index"></div>
</div>
</draggable>
</td>
@stack('move_td_end')
@ -428,4 +426,5 @@
</td>
@stack('name_td_end')
</tr>
</tr>
</tbody>