|
@@ -11,8 +11,19 @@
|
|
|
:active-text-color="variables.menuActiveText"
|
|
|
:collapse-transition="false"
|
|
|
mode="vertical"
|
|
|
+ @select="handleSelect"
|
|
|
>
|
|
|
<sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
|
|
|
+ <el-submenu index="100">
|
|
|
+ <template slot="title">
|
|
|
+ <i class="el-icon-menu" />
|
|
|
+ <span slot="title" @mouseover="getGlobalInterface">数据中心</span>
|
|
|
+ </template>
|
|
|
+ <el-submenu v-for="(myMenu,index) in menu" :key="myMenu.menuName" :index="'100-' + index">
|
|
|
+ <template slot="title">{{ myMenu.menuName }}</template>
|
|
|
+ <el-menu-item v-for="(subMenu,index2) in myMenu.subMenus" :key="subMenu.path" :index="'100-' + index + '-' + index2" @click="handleClick(subMenu)">{{ subMenu.subMenuName }}</el-menu-item>
|
|
|
+ </el-submenu>
|
|
|
+ </el-submenu>
|
|
|
</el-menu>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
@@ -23,12 +34,14 @@ import { mapGetters } from 'vuex'
|
|
|
import Logo from './Logo'
|
|
|
import SidebarItem from './SidebarItem'
|
|
|
import variables from '@/styles/variables.scss'
|
|
|
+import { getGlobalInterface } from '@/api/data.js'
|
|
|
|
|
|
export default {
|
|
|
components: { SidebarItem, Logo },
|
|
|
computed: {
|
|
|
...mapGetters([
|
|
|
- 'sidebar'
|
|
|
+ 'sidebar',
|
|
|
+ 'menu'
|
|
|
]),
|
|
|
routes() {
|
|
|
return this.$router.options.routes
|
|
@@ -51,6 +64,27 @@ export default {
|
|
|
isCollapse() {
|
|
|
return !this.sidebar.opened
|
|
|
}
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getGlobalInterface()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleSelect(key, keypath) {
|
|
|
+ switch (key) {
|
|
|
+ case '100':
|
|
|
+ break
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleClick(subMenu) {
|
|
|
+ this.$store.dispatch('data/setSubMenu', subMenu)
|
|
|
+ this.$router.push({ name: '动态数据' })
|
|
|
+ },
|
|
|
+ getGlobalInterface() {
|
|
|
+ getGlobalInterface()
|
|
|
+ .then(res => {
|
|
|
+ this.$store.dispatch('data/setMenu', res.data)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|