Форматирование кода и настройка типов для isSuccess

This commit is contained in:
Ilia Miheev
2026-03-02 21:12:43 +03:00
parent 12213a0cff
commit 3e66e2d6aa
+17 -26
View File
@@ -1,7 +1,7 @@
<script setup> <script setup>
import {ref, onMounted} from "vue"; import { ref, onMounted } from "vue";
import izitoast from "./izitoast"; import izitoast from "./izitoast";
import {useEventListener} from "@vueuse/core"; import { useEventListener } from "@vueuse/core";
import MyDialog from "./components/MyDialog.vue"; import MyDialog from "./components/MyDialog.vue";
import MyDropMenu from "./components/MyDropMenu.vue"; import MyDropMenu from "./components/MyDropMenu.vue";
import copyToclipboard from "./copyToclipboard"; import copyToclipboard from "./copyToclipboard";
@@ -48,7 +48,7 @@ function setNumber(item) {
function saveResult() { function saveResult() {
let navigate_waites = ""; let navigate_waites = "";
for (const item of listOfTrips.value) { for (const item of listOfTrips.value) {
navigate_waites += `\tnavigate_wait(${item.x}, ${item.y})\n`; navigate_waites += `\tnavigate_wait(${item.x}, ${item.y})\n`;
} }
fetch("/shablons/emergency_and_navigate.txt") fetch("/shablons/emergency_and_navigate.txt")
.then((response) => response.text()) .then((response) => response.text())
@@ -105,7 +105,7 @@ function handleDownloadBtn() {
console.log(finallyText) console.log(finallyText)
// Создание файла // Создание файла
const downloadUrl = ref(''); const downloadUrl = ref('');
const blob = new Blob([finallyText], {type: 'text/plain'}); const blob = new Blob([finallyText], { type: 'text/plain' });
downloadUrl.value = URL.createObjectURL(blob); downloadUrl.value = URL.createObjectURL(blob);
// Задержка для избежания ошибок в некоторых браузерах // Задержка для избежания ошибок в некоторых браузерах
setTimeout(() => { setTimeout(() => {
@@ -129,13 +129,8 @@ function handleDownloadBtn() {
<template> <template>
<div class="wraper"> <div class="wraper">
<div class="grid"> <div class="grid">
<div <div class="square" v-for="(item, index) in numbers" :data-key="index" :key="index"
class="square" @click="setNumber(item)">
v-for="(item, index) in numbers"
:data-key="index"
:key="index"
@click="setNumber(item)"
>
{{ numbers[index].variable.join(", ") }} {{ numbers[index].variable.join(", ") }}
</div> </div>
</div> </div>
@@ -145,16 +140,12 @@ function handleDownloadBtn() {
<button @click="cleanResult">Очистить</button> <button @click="cleanResult">Очистить</button>
<button @click="cancel">Отменить</button> <button @click="cancel">Отменить</button>
</div> </div>
<MyDropMenu/> <MyDropMenu />
</div> </div>
<MyDialog <MyDialog v-show="isModalVisible" @close="isModalVisible = false" class="dialogWindow"
v-show="isModalVisible" :is-success=Boolean(listOfTrips.length)>
@close="isModalVisible = false"
class="dialogWindow"
:is-success=listOfTrips.length
>
<template #header> <template #header>
<strong v-if="listOfTrips.length">Код готов!</strong> <strong v-if="listOfTrips.length">Код готов!</strong>
<strong v-else>Код не готов!</strong> <strong v-else>Код не готов!</strong>
@@ -165,9 +156,9 @@ function handleDownloadBtn() {
</template> </template>
<template #footer> <template #footer>
<div v-if="listOfTrips.length"> <div v-if="listOfTrips.length">
<button type="button" @click="handleDownloadBtn">Скачать код</button> <button @click="handleDownloadBtn">Скачать код</button>
<button type="button" @click="copyAndToast(finallyText)">Скопировать код</button> <button @click="copyAndToast(finallyText)">Скопировать код</button>
<button type="button" @click="isModalVisible = false">ОК</button> <button @click="isModalVisible = false">ОК</button>
</div> </div>
</template> </template>
</MyDialog> </MyDialog>
@@ -196,8 +187,8 @@ html {
} }
.square { .square {
width: var(--side); /* Ширина квадрата */ width: var(--side);
height: var(--side); /* Высота квадрата */ height: var(--side);
background-image: url("images/image.jpg"); background-image: url("images/image.jpg");
background-size: cover; background-size: cover;
border: 3px solid rgb(251, 251, 251); border: 3px solid rgb(251, 251, 251);
@@ -212,9 +203,9 @@ html {
color: white; color: white;
text-shadow: -1px -1px 0 black, text-shadow: -1px -1px 0 black,
1px -1px 0 black, 1px -1px 0 black,
-1px 1px 0 black, -1px 1px 0 black,
1px 1px 0 black; 1px 1px 0 black;
} }
.square:hover { .square:hover {