fix: 🐛 修复build:prod sortablejs错误

Former-commit-id: dafcdc49c68bff61e0ebe087183671a860f67510
This commit is contained in:
Jachin
2023-08-09 11:04:01 +08:00
parent 21017d407b
commit ee68c1f13f
2 changed files with 10 additions and 6 deletions

View File

@@ -76,7 +76,7 @@
</template>
<script setup lang="ts">
//import Sortable from "sortablejs";
import { default as Sortable, SortableEvent } from "sortablejs";
import { fetchList } from "@/api/article";
defineOptions({
@@ -127,14 +127,17 @@ const rowDrag = function () {
const tbody = document.querySelector(
".draggable .el-table__body-wrapper tbody"
);
/* Sortable.create(tbody, {
if (!tbody) return;
Sortable.create(tbody as HTMLElement, {
// 可被拖拽的子元素
draggable: ".draggable .el-table__row",
onEnd({ newIndex, oldIndex }: { newIndex: number; oldIndex: number }) {
const currRow = list.value.splice(oldIndex, 1)[0];
list.value.splice(newIndex, 0, currRow);
onEnd(event: SortableEvent) {
if (event.oldIndex !== undefined && event.newIndex !== undefined) {
const currRow = list.value.splice(event.oldIndex, 1)[0];
list.value.splice(event.newIndex, 0, currRow);
}
},
}); */
});
};
onMounted(() => {