mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 01:58:41 +01:00
unmount un delete
This commit is contained in:
@@ -298,7 +298,7 @@ function onFilterClick(filter: FilterType, value: string) {
|
||||
</v-row>
|
||||
</template>
|
||||
<v-row v-if="rom.is_identified">
|
||||
<v-col cols="12" class="mt-4 text-right">
|
||||
<v-col class="mt-4 text-right">
|
||||
<div class="text-grey">
|
||||
Data provided by
|
||||
<template v-for="(source, index) in dataSources" :key="source.name">
|
||||
|
||||
@@ -24,10 +24,12 @@ import {
|
||||
watch,
|
||||
defineAsyncComponent,
|
||||
onMounted,
|
||||
onBeforeUnmount,
|
||||
} from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useDisplay } from "vuetify";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
// Dynamic import for PDFViewer
|
||||
const PdfViewer = defineAsyncComponent(
|
||||
() => import("@/components/Details/PDFViewer.vue"),
|
||||
@@ -69,6 +71,25 @@ async function fetchDetails() {
|
||||
});
|
||||
}
|
||||
|
||||
function handleKeyDown(event: KeyboardEvent) {
|
||||
if (event.key === "ArrowLeft") {
|
||||
const currentIndex = filteredRoms.value.findIndex(
|
||||
(rom) => rom.id === currentRom.value?.id,
|
||||
);
|
||||
if (currentIndex > 0) {
|
||||
router.push(`/rom/${filteredRoms.value[currentIndex - 1].id}`);
|
||||
}
|
||||
}
|
||||
if (event.key === "ArrowRight") {
|
||||
const currentIndex = filteredRoms.value.findIndex(
|
||||
(rom) => rom.id === currentRom.value?.id,
|
||||
);
|
||||
if (currentIndex < filteredRoms.value.length - 1) {
|
||||
router.push(`/rom/${filteredRoms.value[currentIndex + 1].id}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const romId = parseInt(route.params.rom as string);
|
||||
|
||||
@@ -93,24 +114,11 @@ onBeforeMount(async () => {
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "ArrowLeft") {
|
||||
const currentIndex = filteredRoms.value.findIndex(
|
||||
(rom) => rom.id === currentRom.value?.id,
|
||||
);
|
||||
if (currentIndex > 0) {
|
||||
router.push(`/rom/${filteredRoms.value[currentIndex - 1].id}`);
|
||||
}
|
||||
}
|
||||
if (event.key === "ArrowRight") {
|
||||
const currentIndex = filteredRoms.value.findIndex(
|
||||
(rom) => rom.id === currentRom.value?.id,
|
||||
);
|
||||
if (currentIndex < filteredRoms.value.length - 1) {
|
||||
router.push(`/rom/${filteredRoms.value[currentIndex + 1].id}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
document.addEventListener("keydown", handleKeyDown);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener("keydown", handleKeyDown);
|
||||
});
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user