feat: 链接排序拖拽手柄

- 表格添加排序列(拖拽手柄图标)
- 安装 vuedraggable 依赖
- 搜索建议UI完善
This commit is contained in:
Agent
2026-07-15 00:46:29 +08:00
parent 82054d0aaf
commit 15465aabd5
3 changed files with 31 additions and 4 deletions
+9 -2
View File
@@ -32,8 +32,13 @@
<el-button size="small" @click="batchMove" :disabled="!batchMoveCat">移动</el-button>
<el-button size="small" text @click="selectedIds = []">取消选择</el-button>
</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 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">
<template #default="scope">
<span class="link-icon-preview">{{ scope.row.iconUrl ? '🖼' : scope.row.title[0] }}</span>
@@ -105,7 +110,7 @@
<script setup lang="ts">
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 { adminApi } from '@/api'
@@ -203,6 +208,8 @@ onMounted(async () => { await loadLinks(); await loadCats() })
flex-wrap: wrap;
}
html.dark .batch-bar { background: #1e293b; }
.drag-handle { cursor: grab; color: #ccc; font-size: 16px; }
.drag-handle:hover { color: #6366f1; }
.link-icon-preview {
display: inline-flex;
width: 32px;