mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 02:22:44 +01:00
load on select box click
This commit is contained in:
@@ -5,7 +5,7 @@ import type { DetailedRom } from "@/stores/roms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import { formatTimestamp } from "@/utils";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, ref } from "vue";
|
||||
import { inject, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useDisplay } from "vuetify";
|
||||
|
||||
@@ -49,17 +49,20 @@ const HEADERS = [
|
||||
},
|
||||
] as const;
|
||||
|
||||
function onLoad() {
|
||||
if (selectedSaves.value.length == 0) return;
|
||||
emitter?.emit("saveSelected", selectedSaves.value[0]);
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
show.value = false;
|
||||
rom.value = null;
|
||||
selectedSaves.value = [];
|
||||
}
|
||||
|
||||
watch(
|
||||
() => selectedSaves.value,
|
||||
() => {
|
||||
if (selectedSaves.value.length == 0) return;
|
||||
emitter?.emit("saveSelected", selectedSaves.value[0]);
|
||||
closeDialog();
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -113,14 +116,8 @@ function closeDialog() {
|
||||
</template>
|
||||
<template #append>
|
||||
<v-row class="justify-center my-2">
|
||||
<v-btn
|
||||
class="bg-toplayer"
|
||||
color="primary"
|
||||
variant="tonal"
|
||||
:disabled="selectedSaves.length == 0"
|
||||
@click="onLoad"
|
||||
>
|
||||
Load
|
||||
<v-btn class="bg-toplayer" variant="flat" @click="closeDialog">
|
||||
Cancel
|
||||
</v-btn>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { DetailedRom } from "@/stores/roms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import { formatTimestamp } from "@/utils";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, ref } from "vue";
|
||||
import { inject, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useDisplay } from "vuetify";
|
||||
|
||||
@@ -60,6 +60,15 @@ function closeDialog() {
|
||||
rom.value = null;
|
||||
selectedStates.value = [];
|
||||
}
|
||||
|
||||
watch(
|
||||
() => selectedStates.value,
|
||||
() => {
|
||||
if (selectedStates.value.length == 0) return;
|
||||
emitter?.emit("stateSelected", selectedStates.value[0]);
|
||||
closeDialog();
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -113,14 +122,8 @@ function closeDialog() {
|
||||
</template>
|
||||
<template #append>
|
||||
<v-row class="justify-center my-2">
|
||||
<v-btn
|
||||
class="bg-toplayer"
|
||||
color="primary"
|
||||
variant="tonal"
|
||||
:disabled="selectedStates.length == 0"
|
||||
@click="onLoad"
|
||||
>
|
||||
Load
|
||||
<v-btn class="bg-toplayer" variant="flat" @click="closeDialog">
|
||||
Cancel
|
||||
</v-btn>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user