From 79e133c1675c9c71982ec21da76f009ccb569b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E5=85=83=E7=9A=93?= Date: Sun, 25 May 2025 09:11:10 +0800 Subject: [PATCH] Update tab system & Made a basic Loading Screen w/ transitions --- components/app/windows/news.vue | 44 ++++++++++++++++++++++++++------- pages/desktop.vue | 2 ++ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/components/app/windows/news.vue b/components/app/windows/news.vue index 1cd100b..22f4eaf 100644 --- a/components/app/windows/news.vue +++ b/components/app/windows/news.vue @@ -14,11 +14,18 @@ const tabs = [ }, ]; -const primary = ref(tabs.find((tab) => tab.default === true).url || "domestic"); +const primary = ref( + tabs.find((tab) => tab.default === true).url || "domestic", +); const contentArray = ref([]); const errorr = ref(false); +const switchTabs = ref(false); -const updateContent = async (url: string) => { +const updateContent = async (url: string, tabAction: boolean) => { + if (tabAction === true) { + primary.value = url; + switchTabs.value = true; + } console.log(url.trim()); try { const req = await fetch(`/api/home/lt?query=${url.trim()}`); @@ -26,6 +33,7 @@ const updateContent = async (url: string) => { console.log(data); if (data) { contentArray.value = [...data.uuidData, ...(data.nuuiddata?.items || [])]; + switchTabs.value = false; } } catch (e) { errorr.value = true; @@ -45,8 +53,13 @@ const isPrimary = (url: string, defaultAction: boolean) => { } return "text-black"; }; + +const openNews = (url: string) => { + console.log(url); +}; + onMounted(async () => { - await updateContent(primary.value); + await updateContent(primary.value, false); }); diff --git a/pages/desktop.vue b/pages/desktop.vue index 02eb429..9219e1b 100644 --- a/pages/desktop.vue +++ b/pages/desktop.vue @@ -166,6 +166,8 @@ const associAppWindow = [ id: "11", title: t("app.newsview"), component: NewsViewWindow, + width: "700px", + height: "500px", }, ];