|
- <template>
- <div id="app">
- <van-nav-bar v-if="path !== '/login'" :title="navTitle" fixed />
- <router-view />
- <van-tabbar v-model="active" v-if="path !== '/login'" @change="handleChangeTabbar">
- <van-tabbar-item icon="wap-home" :to="{ path: '/' }">首页</van-tabbar-item>
- <van-tabbar-item icon="setting" :to="{ path: '/setting' }">设置</van-tabbar-item>
- </van-tabbar>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- navTitle: '警报列表'
- }
- },
- computed: {
- path() {
- return this.$route.path
- },
- active: {
- get: function() {
- return this.$route.path === '/' ? 0 : 1
- },
- set: function() {}
- }
- },
- mounted() {
- const navTitle = localStorage.getItem('navTitle')
- if (navTitle) {
- this.navTitle = navTitle
- } else {
- localStorage.setItem('navTitle', this.navTitle)
- }
- },
- methods: {
- handleChangeTabbar(active) {
- this.navTitle = active === 0 ? '警报列表': '设置中心'
- localStorage.setItem('navTitle', this.navTitle)
- }
- }
- }
- </script>
- <style lang="less">
- #app {
- font-family: "Avenir", Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- //text-align: center;
- color: #2c3e50;
- overflow: hidden;
- }
- a:-webkit-any-link {
- text-decoration: none;
- }
-
- input:-webkit-autofill {
- -webkit-box-shadow: 0 0 0px 1000px white inset;
- }
-
- input {
- filter: none !important;
- }
- </style>
|