Document item draggable code-refactoring..
This commit is contained in:
parent
93dda9874d
commit
98188ea0cd
@ -76,7 +76,7 @@
|
||||
}">
|
||||
</el-date-picker>
|
||||
|
||||
<div class="w-20 px-2 text-sm text-center">
|
||||
<div class="w-24 px-2 text-sm text-center">
|
||||
{{ middleText }}
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,6 @@ const app = new Vue({
|
||||
],
|
||||
email_template: false,
|
||||
send_to: false,
|
||||
drag: false
|
||||
}
|
||||
},
|
||||
|
||||
@ -117,14 +116,11 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
methods: {
|
||||
onEnd() {
|
||||
this.dragging = false;
|
||||
},
|
||||
onItemSortUpdate(event) {
|
||||
let item_index = this.form.items.indexOf(this.form.items[event.oldIndex]);
|
||||
let item = this.form.items.splice(item_index, 1)[0];
|
||||
|
||||
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);
|
||||
this.form.items.splice(event.newIndex, 0, item);
|
||||
},
|
||||
|
||||
onRefFocus(ref) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
<tbody is="draggable" tag="tbody" handle=".handle" @start="dragging = true" @end="dragging = false" @update="onUpdate">
|
||||
<tbody is="draggable" tag="tbody" handle=".handle" @start="dragging = true" @end="dragging = false" @update="onItemSortUpdate">
|
||||
<tr v-for="(row, index) in items" :index="index">
|
||||
@stack('name_td_start')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user