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