mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
fix(dialog): snackbar 替换 dialog
This commit is contained in:
@@ -104,14 +104,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<v-snackbar v-model="snackbar" timeout="1500" color="error"> 未找到相关卡牌 </v-snackbar>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
// vue
|
// vue
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import TLoading from "../components/t-loading.vue";
|
import TLoading from "../components/t-loading.vue";
|
||||||
// tauri
|
|
||||||
import { dialog } from "@tauri-apps/api";
|
|
||||||
// utils
|
// utils
|
||||||
import { createTGWindow } from "../utils/TGWindow";
|
import { createTGWindow } from "../utils/TGWindow";
|
||||||
import { ReadAllTGData } from "../utils/TGIndex";
|
import { ReadAllTGData } from "../utils/TGIndex";
|
||||||
@@ -119,9 +118,14 @@ import { ReadAllTGData } from "../utils/TGIndex";
|
|||||||
import { BaseCard, ActionCard, CharacterCard, MonsterCard } from "../interface/GCG";
|
import { BaseCard, ActionCard, CharacterCard, MonsterCard } from "../interface/GCG";
|
||||||
import { OBC_CONTENT_API } from "../plugins/Mys/interface/utils";
|
import { OBC_CONTENT_API } from "../plugins/Mys/interface/utils";
|
||||||
|
|
||||||
|
// loading
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
// snackbar
|
||||||
|
const snackbar = ref(false);
|
||||||
|
// search
|
||||||
const doSearch = ref(false);
|
const doSearch = ref(false);
|
||||||
const search = ref("");
|
const search = ref("");
|
||||||
|
// data
|
||||||
const tab = ref("character");
|
const tab = ref("character");
|
||||||
const CardsInfoC = ref([] as CharacterCard[]);
|
const CardsInfoC = ref([] as CharacterCard[]);
|
||||||
const CardsInfoA = ref([] as ActionCard[]);
|
const CardsInfoA = ref([] as ActionCard[]);
|
||||||
@@ -152,7 +156,7 @@ async function searchCard() {
|
|||||||
res.sort((a, b) => a.name.localeCompare(b.name));
|
res.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
if (res.length == 0) {
|
if (res.length == 0) {
|
||||||
await dialog.message("未找到相关卡牌");
|
snackbar.value = true;
|
||||||
doSearch.value = false;
|
doSearch.value = false;
|
||||||
} else {
|
} else {
|
||||||
CardsInfoS.value = res;
|
CardsInfoS.value = res;
|
||||||
|
|||||||
@@ -133,6 +133,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</v-window-item>
|
</v-window-item>
|
||||||
</v-window>
|
</v-window>
|
||||||
|
<v-snackbar v-model="snackbar" timeout="1500" :color="snackbarColor">
|
||||||
|
{{ snackbarText }}
|
||||||
|
</v-snackbar>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -141,8 +144,6 @@
|
|||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import TLoading from "../components/t-loading.vue";
|
import TLoading from "../components/t-loading.vue";
|
||||||
// tauri
|
|
||||||
import { dialog } from "@tauri-apps/api";
|
|
||||||
// store
|
// store
|
||||||
import useAppStore from "../store/modules/app";
|
import useAppStore from "../store/modules/app";
|
||||||
// plugin
|
// plugin
|
||||||
@@ -159,6 +160,10 @@ const appStore = useAppStore();
|
|||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const loadingTitle = ref("正在加载");
|
const loadingTitle = ref("正在加载");
|
||||||
const loadingSub = ref(false);
|
const loadingSub = ref(false);
|
||||||
|
// snackbar
|
||||||
|
const snackbar = ref(false);
|
||||||
|
const snackbarText = ref("");
|
||||||
|
const snackbarColor = ref("success");
|
||||||
// 路由
|
// 路由
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
// search
|
// search
|
||||||
@@ -219,7 +224,9 @@ async function loadMore(data: string) {
|
|||||||
switch (data) {
|
switch (data) {
|
||||||
case "notice":
|
case "notice":
|
||||||
if (rawData.value.notice.is_last) {
|
if (rawData.value.notice.is_last) {
|
||||||
await dialog.message("已经是最后一页了");
|
snackbarText.value = "已经是最后一页了";
|
||||||
|
snackbarColor.value = "#35acce";
|
||||||
|
snackbar.value = true;
|
||||||
loadingSub.value = false;
|
loadingSub.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -232,7 +239,9 @@ async function loadMore(data: string) {
|
|||||||
break;
|
break;
|
||||||
case "activity":
|
case "activity":
|
||||||
if (rawData.value.activity.is_last) {
|
if (rawData.value.activity.is_last) {
|
||||||
await dialog.message("已经是最后一页了");
|
snackbarText.value = "已经是最后一页了";
|
||||||
|
snackbarColor.value = "#35acce";
|
||||||
|
snackbar.value = true;
|
||||||
loadingSub.value = false;
|
loadingSub.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -245,7 +254,9 @@ async function loadMore(data: string) {
|
|||||||
break;
|
break;
|
||||||
case "news":
|
case "news":
|
||||||
if (rawData.value.news.is_last) {
|
if (rawData.value.news.is_last) {
|
||||||
await dialog.message("已经是最后一页了");
|
snackbarText.value = "已经是最后一页了";
|
||||||
|
snackbarColor.value = "#35acce";
|
||||||
|
snackbar.value = true;
|
||||||
loadingSub.value = false;
|
loadingSub.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -302,14 +313,18 @@ async function toJson(item: NewsCard | string) {
|
|||||||
|
|
||||||
async function searchPost() {
|
async function searchPost() {
|
||||||
if (search.value === "") {
|
if (search.value === "") {
|
||||||
await dialog.message("请输入搜索内容");
|
snackbarText.value = "请输入搜索内容";
|
||||||
|
snackbarColor.value = "error";
|
||||||
|
snackbar.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isNaN(Number(search.value))) {
|
if (!isNaN(Number(search.value))) {
|
||||||
await toPost(search.value);
|
await toPost(search.value);
|
||||||
await toJson(search.value);
|
await toJson(search.value);
|
||||||
} else {
|
} else {
|
||||||
await dialog.message("请输入数字");
|
snackbarText.value = "请输入搜索内容";
|
||||||
|
snackbarColor.value = "error";
|
||||||
|
snackbar.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user