Blame view

src/components/index.vue 1.46 KB
22fb20b3   songchongxian   城市停车运营监控
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  <template>
    <el-container>
      <el-header class='header'>
        <el-row>
          <el-col :span="23">
            <el-menu :default-active="$route.path" mode="horizontal" class="nav_box" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" >
            	<template v-for="item in newrouter[0].children" v-if="!item.hidden">
            		<router-link v-if="!item.hidden&&!item.children" :to="item.path">
            	       <el-menu-item :index="item.path" >
                      {{ item.name}}
                     </el-menu-item>
                 </router-link>
              </template>
            </el-menu>
          </el-col>
          <el-col :span="1"> 
            <div class="logout_box" @click="logout()">退出</div>
          </el-col>
        </el-row>
      </el-header>
      <el-main>
        <router-view class="view"></router-view>
     </el-main>
    </el-container>
  </template>
  
  <script>
  import { mapGetters } from 'vuex';
  export default {
    name: 'index',
    data () {
      return {
       
      }
    },
    computed: {
      ...mapGetters([
          'newrouter'
      ])
    },
    methods: {
      logout(){
      	this.$store.dispatch('Logout').then(() => {
              this.$router.push({ path: '/login' });
          }).catch(err => {
              this.$message.error(err);
          });
      }
    },
    mounted(){
    
    }
  }
  </script>
  
  <style scoped>
  .header{
  	padding: 0px;
  }
  .nav_box{
  	border-bottom: 0px;
  }
  .logout_box{
  	background-color: #545c64;
  	line-height: 60px;
      width: 100%;
      color:#fff;
  }
  </style>