split mobile mixin from socket mixin

This commit is contained in:
LouisLam 2021-08-10 15:02:46 +08:00
parent d1d000bd74
commit 9ba1743900
4 changed files with 47 additions and 13 deletions

View file

@ -1,5 +1,5 @@
<template>
<div :class="$root.theme">
<div :class="classes">
<div v-if="! $root.socket.connected && ! $root.socket.firstConnect" class="lost-connection">
<div class="container-fluid">
{{ $root.connectionErrorMsg }}
@ -79,29 +79,45 @@
import Login from "../components/Login.vue";
export default {
components: {
Login,
},
data() {
return {}
},
computed: {},
computed: {
// Theme or Mobile
classes() {
const classes = {};
classes[this.$root.theme] = true;
classes["mobile"] = this.$root.isMobile;
return classes;
}
},
watch: {
$route (to, from) {
this.init();
},
},
mounted() {
this.init();
},
methods: {
init() {
if (this.$route.name === "root") {
this.$router.push("/dashboard")
}
},
},
}
</script>