add 2 extra pages

This commit is contained in:
DESKTOP-FUDKNA8\znjsz 2024-02-28 16:07:44 +08:00
parent 544e42ac83
commit 23bf4790df
4 changed files with 45 additions and 3 deletions

18
src/AlertListScreen.vue Normal file
View File

@ -0,0 +1,18 @@
<script setup>
import { ref, onMounted } from "vue";
</script>
<template>
<main class="alertlist-screen">
<h1 style="color: red">alert list</h1>
</main>
</template>
<style scoped>
.alertlist-screen {
background: #e6e6e6;
height: 100vh;
width: 100vw;
display: inline-block;
}
</style>

View File

@ -1,17 +1,20 @@
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import MainPage from "./MainPage.vue"; import MainPage from "./MainPage.vue";
import MainScreen from "./MainScreen.vue";
import AlertListScreen from "./AlertListScreen.vue";
// import Slider from "./components/Slider.vue"; // import Slider from "./components/Slider.vue";
import useWebsocket from "./utils/useWebsocket"; import useWebsocket from "./utils/useWebsocket";
import { useWsStore } from "./store"; import { useWsStore } from "./store";
const store = useWsStore(); const store = useWsStore();
const excludePaths = ["/alert-list", "/main-screen"];
// use websocket // use websocket
let urlPath = ref(document.location.pathname); let urlPath = ref(document.location.pathname);
if (urlPath.value === "/") { if (urlPath.value === "/") {
urlPath.value = "/1-1"; urlPath.value = "/1-1";
} }
useWebsocket(store, urlPath.value); useWebsocket(store, urlPath.value, excludePaths);
// size setting // size setting
// const size = ref(80); // const size = ref(80);
@ -33,8 +36,10 @@ useWebsocket(store, urlPath.value);
<template> <template>
<div id="app-container"> <div id="app-container">
<MainPage :path="urlPath" />
<!-- <Slider :size="size" @size-change="setSize" /> --> <!-- <Slider :size="size" @size-change="setSize" /> -->
<MainPage v-if="!excludePaths.includes(urlPath)" :path="urlPath" />
<MainScreen v-if="urlPath == '/main-screen'" />
<AlertListScreen v-if="urlPath == '/alert-list'" />
</div> </div>
</template> </template>

18
src/MainScreen.vue Normal file
View File

@ -0,0 +1,18 @@
<script setup>
import { ref, onMounted } from "vue";
</script>
<template>
<main class="main-screen">
<h1>main screen</h1>
</main>
</template>
<style scoped>
.main-screen {
background: #e6e6e6;
height: 100vh;
width: 100vw;
display: inline-block;
}
</style>

View File

@ -1,6 +1,7 @@
import Client from "./ws"; import Client from "./ws";
export default function useWebsocket(store, path) { export default function useWebsocket(store, path, excludePaths = []) {
if (excludePaths.includes(path)) return;
// connect0(store); // connect0(store);
connectPath(store, path); connectPath(store, path);
} }