feat(admin): add route reordering with up/down buttons

This commit is contained in:
RhenCloud 2026-08-03 08:40:59 +08:00
parent ac8b4a77b8
commit 7ee1e5899f
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
4 changed files with 54 additions and 3 deletions

View file

@ -19,6 +19,22 @@
<span v-if="route.fallback" class="badge fallback">{{ t("route.fallback") }}</span>
</div>
<div class="card-actions">
<button
class="icon-btn"
:disabled="atFirst"
:title="t('route.moveUp')"
@click="$emit('move', route, -1)"
>
</button>
<button
class="icon-btn"
:disabled="atLast"
:title="t('route.moveDown')"
@click="$emit('move', route, 1)"
>
</button>
<button class="icon-btn" :title="t('routeEditor.editTitle')" @click="$emit('edit', route)">
</button>
@ -67,11 +83,12 @@ import { fmtMatch } from "~/types";
const { t } = useI18n();
const props = defineProps<{ route: Route }>();
const props = defineProps<{ route: Route; atFirst?: boolean; atLast?: boolean }>();
const emit = defineEmits<{
(e: "toggle", route: Route): void;
(e: "edit", route: Route): void;
(e: "delete", route: Route): void;
(e: "move", route: Route, dir: -1 | 1): void;
}>();
function onToggle(event: Event): void {