left and right key
This commit is contained in:
18
src/App.vue
18
src/App.vue
@@ -6,11 +6,27 @@ import { useGalleryStore } from "./stores/gallery";
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { FolderOpen, Download } from 'lucide-vue-next';
|
||||
import { ref } from "vue";
|
||||
import { ref, onMounted, onUnmounted } from "vue";
|
||||
|
||||
const store = useGalleryStore();
|
||||
const isExporting = ref(false);
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'ArrowRight') {
|
||||
store.nextImage();
|
||||
} else if (event.key === 'ArrowLeft') {
|
||||
store.prevImage();
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('keydown', handleKeydown);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('keydown', handleKeydown);
|
||||
});
|
||||
|
||||
async function openFolder() {
|
||||
try {
|
||||
const selected = await open({
|
||||
|
||||
Reference in New Issue
Block a user