prevent filcker when swtiching config

This commit is contained in:
pa
2026-01-02 16:50:59 +09:00
committed by Natsumi
parent 367a517337
commit ceb36d0c90
+11 -2
View File
@@ -105,7 +105,7 @@
</template> </template>
<script setup> <script setup>
import { computed, nextTick, ref, watch } from 'vue'; import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
import { CopyDocument, Warning } from '@element-plus/icons-vue'; import { CopyDocument, Warning } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox } from 'element-plus'; import { ElMessage, ElMessageBox } from 'element-plus';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
@@ -135,6 +135,12 @@
const launchDialogIndex = ref(2000); const launchDialogIndex = ref(2000);
let launchAsDesktopTimeoutId;
onBeforeUnmount(() => {
clearTimeout(launchAsDesktopTimeoutId);
});
const launchDialog = ref({ const launchDialog = ref({
loading: false, loading: false,
desktop: false, desktop: false,
@@ -231,9 +237,12 @@
function handleLaunchCommand(command, location, shortName) { function handleLaunchCommand(command, location, shortName) {
const desktop = command === 'desktop'; const desktop = command === 'desktop';
launchDialog.value.desktop = desktop;
configRepository.setBool('launchAsDesktop', desktop); configRepository.setBool('launchAsDesktop', desktop);
handleLaunchGame(location, shortName, desktop); handleLaunchGame(location, shortName, desktop);
clearTimeout(launchAsDesktopTimeoutId);
launchAsDesktopTimeoutId = setTimeout(() => {
launchDialog.value.desktop = desktop;
}, 500);
} }
function handleAttachGame(location, shortName) { function handleAttachGame(location, shortName) {
tryOpenInstanceInVrc(location, shortName); tryOpenInstanceInVrc(location, shortName);