Whalebird-desktop-client-ma.../src/renderer/components/GlobalHeader.vue

76 lines
1.4 KiB
Vue
Raw Normal View History

2018-03-08 11:53:14 +01:00
<template>
<div id="global_header">
<el-menu
:default-active="defaultActive"
class="el-menu-vertical"
@open="instanceSelected"
@close="instanceClosed"
:collapse="isCollapse"
background-color="#545c64"
text-color="#909399"
active-text-color="#ffffff">
<el-menu-item index="1">
<i class="el-icon-menu"></i>
<span slot="title">First server</span>
</el-menu-item>
</el-menu>
<div class="content">
<router-view></router-view>
</div>
</div>
</template>
<script>
2018-03-08 15:08:33 +01:00
import { mapState } from 'vuex'
2018-03-08 11:53:14 +01:00
export default {
name: 'global-header',
data () {
return {
isCollapse: true,
defaultActive: '1'
}
},
2018-03-08 15:08:33 +01:00
computed: {
...mapState({
instances: state => state.GlobalHeader.instances
})
},
2018-03-08 11:53:14 +01:00
created () {
2018-03-08 15:08:33 +01:00
this.$store.dispatch('GlobalHeader/listInstances')
.catch(() => {
this.$router.push({ path: '/login' })
})
2018-03-08 11:53:14 +01:00
},
methods: {
instanceSelected (key, keyPath) {
console.log(key, keyPath)
},
instanceClosed (key, keyPath) {
console.log(key, keyPath)
}
}
}
</script>
<style lang="scss">
html, body, #app, #global_header {
height: 100%;
margin: 0;
}
#global_header {
.el-menu {
height: 100%;
position: fixed;
top: 0;
left: 0;
width: 65px;
}
.content {
margin-left: 65px;
}
}
</style>