feat: 链接排序拖拽手柄
- 表格添加排序列(拖拽手柄图标) - 安装 vuedraggable 依赖 - 搜索建议UI完善
This commit is contained in:
Generated
+20
-1
@@ -13,7 +13,8 @@
|
|||||||
"element-plus": "^2.9.6",
|
"element-plus": "^2.9.6",
|
||||||
"pinia": "^2.3.0",
|
"pinia": "^2.3.0",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
"vue-router": "^4.5.0"
|
"vue-router": "^4.5.0",
|
||||||
|
"vuedraggable": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
@@ -2714,6 +2715,12 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sortablejs": {
|
||||||
|
"version": "1.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.14.0.tgz",
|
||||||
|
"integrity": "sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||||
@@ -3106,6 +3113,18 @@
|
|||||||
"typescript": ">=5.0.0"
|
"typescript": ">=5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/vuedraggable": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-FU5HCWBmsf20GpP3eudURW3WdWTKIbEIQxh9/8GE806hydR9qZqRRxRE3RjqX7PkuLuMQG/A7n3cfj9rCEchww==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"sortablejs": "1.14.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"vue": "^3.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/webpack-virtual-modules": {
|
"node_modules/webpack-virtual-modules": {
|
||||||
"version": "0.6.2",
|
"version": "0.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz",
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
"element-plus": "^2.9.6",
|
"element-plus": "^2.9.6",
|
||||||
"pinia": "^2.3.0",
|
"pinia": "^2.3.0",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
"vue-router": "^4.5.0"
|
"vue-router": "^4.5.0",
|
||||||
|
"vuedraggable": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
|
|||||||
@@ -32,8 +32,13 @@
|
|||||||
<el-button size="small" @click="batchMove" :disabled="!batchMoveCat">移动</el-button>
|
<el-button size="small" @click="batchMove" :disabled="!batchMoveCat">移动</el-button>
|
||||||
<el-button size="small" text @click="selectedIds = []">取消选择</el-button>
|
<el-button size="small" text @click="selectedIds = []">取消选择</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="links" @selection-change="(rows:any) => selectedIds = rows.map((r:any) => r.id)">
|
<el-table :data="links" @selection-change="(rows:any) => selectedIds = rows.map((r:any) => r.id)" row-key="id">
|
||||||
<el-table-column type="selection" width="45" />
|
<el-table-column type="selection" width="45" />
|
||||||
|
<el-table-column label="排序" width="50" align="center">
|
||||||
|
<template #default>
|
||||||
|
<el-icon class="drag-handle"><Rank /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="图标" width="60" align="center">
|
<el-table-column label="图标" width="60" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="link-icon-preview">{{ scope.row.iconUrl ? '🖼' : scope.row.title[0] }}</span>
|
<span class="link-icon-preview">{{ scope.row.iconUrl ? '🖼' : scope.row.title[0] }}</span>
|
||||||
@@ -105,7 +110,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { Plus } from '@element-plus/icons-vue'
|
import { Plus, Rank } from '@element-plus/icons-vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { adminApi } from '@/api'
|
import { adminApi } from '@/api'
|
||||||
|
|
||||||
@@ -203,6 +208,8 @@ onMounted(async () => { await loadLinks(); await loadCats() })
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
html.dark .batch-bar { background: #1e293b; }
|
html.dark .batch-bar { background: #1e293b; }
|
||||||
|
.drag-handle { cursor: grab; color: #ccc; font-size: 16px; }
|
||||||
|
.drag-handle:hover { color: #6366f1; }
|
||||||
.link-icon-preview {
|
.link-icon-preview {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
|
|||||||
Reference in New Issue
Block a user