add /list for mobile

This commit is contained in:
LouisLam 2021-08-19 18:12:52 +08:00
parent 4f70a70dda
commit 64498163e1
5 changed files with 27 additions and 12 deletions

View file

@ -4,7 +4,7 @@
No Monitors, please <router-link to="/add">add one</router-link>. No Monitors, please <router-link to="/add">add one</router-link>.
</div> </div>
<router-link v-for="(item, index) in sortedMonitorList" :key="index" :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }" @click="$root.cancelActiveList"> <router-link v-for="(item, index) in sortedMonitorList" :key="index" :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }">
<div class="row"> <div class="row">
<div class="col-6 col-md-8 small-padding" :class="{ 'monitorItem': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }"> <div class="col-6 col-md-8 small-padding" :class="{ 'monitorItem': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }">
<div class="info"> <div class="info">

View file

@ -52,22 +52,22 @@
<!-- Mobile Only --> <!-- Mobile Only -->
<div v-if="$root.isMobile" style="width: 100%;height: 60px;" /> <div v-if="$root.isMobile" style="width: 100%;height: 60px;" />
<nav v-if="$root.isMobile" class="bottom-nav"> <nav v-if="$root.isMobile" class="bottom-nav">
<router-link to="/dashboard" class="nav-link" @click="$root.cancelActiveList"> <router-link to="/dashboard" class="nav-link">
<div><font-awesome-icon icon="tachometer-alt" /></div> <div><font-awesome-icon icon="tachometer-alt" /></div>
Dashboard Dashboard
</router-link> </router-link>
<a href="#" :class=" { 'router-link-exact-active' : $root.showListMobile } " @click="$root.showListMobile = ! $root.showListMobile"> <router-link to="/list" class="nav-link">
<div><font-awesome-icon icon="list" /></div> <div><font-awesome-icon icon="list" /></div>
List List
</a> </router-link>
<router-link to="/add" class="nav-link" @click="$root.cancelActiveList"> <router-link to="/add" class="nav-link">
<div><font-awesome-icon icon="plus" /></div> <div><font-awesome-icon icon="plus" /></div>
Add Add
</router-link> </router-link>
<router-link to="/settings" class="nav-link" @click="$root.cancelActiveList"> <router-link to="/settings" class="nav-link">
<div><font-awesome-icon icon="cog" /></div> <div><font-awesome-icon icon="cog" /></div>
Settings Settings
</router-link> </router-link>
@ -101,7 +101,7 @@ export default {
}, },
watch: { watch: {
$route (to, from) { $route(to, from) {
this.init(); this.init();
}, },
}, },

View file

@ -18,6 +18,8 @@ import Details from "./pages/Details.vue";
import EditMonitor from "./pages/EditMonitor.vue"; import EditMonitor from "./pages/EditMonitor.vue";
import Settings from "./pages/Settings.vue"; import Settings from "./pages/Settings.vue";
import Setup from "./pages/Setup.vue"; import Setup from "./pages/Setup.vue";
import List from "./pages/List.vue";
import { appName } from "./util.ts"; import { appName } from "./util.ts";
const routes = [ const routes = [
@ -53,6 +55,10 @@ const routes = [
path: "/add", path: "/add",
component: EditMonitor, component: EditMonitor,
}, },
{
path: "/list",
component: List,
},
], ],
}, },
{ {

View file

@ -25,7 +25,6 @@ export default {
uptimeList: { }, uptimeList: { },
certInfoList: {}, certInfoList: {},
notificationList: [], notificationList: [],
showListMobile: false,
connectionErrorMsg: "Cannot connect to the socket server. Reconnecting...", connectionErrorMsg: "Cannot connect to the socket server. Reconnecting...",
} }
}, },
@ -186,10 +185,6 @@ export default {
methods: { methods: {
cancelActiveList() {
this.$root.showListMobile = false;
},
storage() { storage() {
return (this.remember) ? localStorage : sessionStorage; return (this.remember) ? localStorage : sessionStorage;
}, },

14
src/pages/List.vue Normal file
View file

@ -0,0 +1,14 @@
<template>
<MonitorList />
</template>
<script>
import MonitorList from "../components/MonitorList.vue";
export default {
components: {
MonitorList,
},
}
</script>