|
@@ -60,23 +60,30 @@
|
|
|
console.log(evt);
|
|
|
console.log(`移动前的位置索引`, evt.oldIndex);
|
|
|
console.log(`移动后的位置索引`, evt.newIndex);
|
|
|
- const newIndex = evt.newIndex as number;
|
|
|
- const oldIndex = evt.oldIndex as number;
|
|
|
- const temp = state.list[oldIndex];
|
|
|
- state.list[oldIndex] = state.list[newIndex];
|
|
|
- state.list[newIndex] = temp;
|
|
|
- console.log(`list`, state.list);
|
|
|
+ // // const newIndex = evt.newIndex as number;
|
|
|
+ // const oldIndex = evt.oldIndex as number;
|
|
|
+ // const newIndex = evt.newIndex as number;
|
|
|
+ // const current = state.list[oldIndex];
|
|
|
+ // const list: object[] = [];
|
|
|
+ // state.list.map((item, index) => {
|
|
|
+ // if (index != oldIndex) {
|
|
|
+ // list.push(item);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // list.splice(newIndex, 0, current);
|
|
|
+ // console.log(`list`, list);
|
|
|
+ // state.list = list;
|
|
|
+ // console.log(`list`, state.list);
|
|
|
},
|
|
|
});
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
initSortable(); // 开启拖拽功能
|
|
|
- // console.log(`fn`, fn)
|
|
|
});
|
|
|
|
|
|
function create() {
|
|
|
console.log(`state.list`, state.list);
|
|
|
- state.list.push({ name: '' });
|
|
|
+ state.list.push({ name: '', value: '' });
|
|
|
}
|
|
|
function remove(i) {
|
|
|
console.log(`i`, i);
|