Merge pull request #17 from ygcaicn/master
修复build:prod sortablejs错误 Former-commit-id: fcd8a0d5a3ccc9d4da5afddf8a651d63aab74929
This commit is contained in:
@@ -69,6 +69,7 @@
|
|||||||
"@types/lodash": "^4.14.195",
|
"@types/lodash": "^4.14.195",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
"@types/path-browserify": "^1.0.0",
|
"@types/path-browserify": "^1.0.0",
|
||||||
|
"@types/sortablejs": "^1.15.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
||||||
"@typescript-eslint/parser": "^5.59.6",
|
"@typescript-eslint/parser": "^5.59.6",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
|
|||||||
@@ -83,6 +83,6 @@ export function deleteArticle(id: number) {
|
|||||||
return request({
|
return request({
|
||||||
url: "/api/v1/article/delete",
|
url: "/api/v1/article/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
params: { id },
|
data: { id },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
//import Sortable from "sortablejs";
|
import { default as Sortable, SortableEvent } from "sortablejs";
|
||||||
import { fetchList } from "@/api/article";
|
import { fetchList } from "@/api/article";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@@ -127,14 +127,17 @@ const rowDrag = function () {
|
|||||||
const tbody = document.querySelector(
|
const tbody = document.querySelector(
|
||||||
".draggable .el-table__body-wrapper tbody"
|
".draggable .el-table__body-wrapper tbody"
|
||||||
);
|
);
|
||||||
/* Sortable.create(tbody, {
|
if (!tbody) return;
|
||||||
|
Sortable.create(tbody as HTMLElement, {
|
||||||
// 可被拖拽的子元素
|
// 可被拖拽的子元素
|
||||||
draggable: ".draggable .el-table__row",
|
draggable: ".draggable .el-table__row",
|
||||||
onEnd({ newIndex, oldIndex }: { newIndex: number; oldIndex: number }) {
|
onEnd(event: SortableEvent) {
|
||||||
const currRow = list.value.splice(oldIndex, 1)[0];
|
if (event.oldIndex !== undefined && event.newIndex !== undefined) {
|
||||||
list.value.splice(newIndex, 0, currRow);
|
const currRow = list.value.splice(event.oldIndex, 1)[0];
|
||||||
|
list.value.splice(event.newIndex, 0, currRow);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}); */
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user