提交 ddf4a1c0 编写于 作者: E Evan

chore: daily optimization

上级 c732170e
<template> <template>
<div> <div>
<el-menu <el-menu
:default-active="'/admin/users'" :default-active="currentPath"
class="el-menu-admin" class="el-menu-admin"
router router
@select="handleSelect"
mode="vertical" mode="vertical"
background-color="#545c64" background-color="#545c64"
text-color="#fff" text-color="#fff"
active-text-color="#ffd04b"> active-text-color="#ffd04b">
<div style="height: 80px;"></div> <div style="height: 80px;"></div>
<template v-for="(item,i) in adminMenus">
<!--index 没有用但是必需字段--> <!--index 没有用但是必需字段-->
<el-submenu :key="i" :index="i + ''" style="text-align: left"> <el-submenu v-for="(item,i) in adminMenus" :key="i" :index="i + ''" style="text-align: left">
<span slot="title" style="font-size: 17px;"> <span slot="title" style="font-size: 17px;">
<i :class="item.iconCls"></i> <i :class="item.iconCls"></i>
{{item.nameZh}} {{item.nameZh}}
</span> </span>
<el-menu-item v-for="child in item.children" :key="child.path" :index="child.path"> <el-menu-item v-for="(child,j) in item.children" :key="j" :index="child.path">
<i :class="child.icon"></i> <i :class="child.icon"></i>
{{ child.nameZh }} {{ child.nameZh }}
</el-menu-item> </el-menu-item>
</el-submenu> </el-submenu>
</template>
</el-menu> </el-menu>
</div> </div>
</template> </template>
...@@ -29,9 +28,21 @@ ...@@ -29,9 +28,21 @@
<script> <script>
export default { export default {
name: 'AdminMenu', name: 'AdminMenu',
data () {
return {
// currentPath: this.$route.path
}
},
computed: { computed: {
adminMenus () { adminMenus () {
return this.$store.state.adminMenus return this.$store.state.adminMenus
},
currentPath () {
return this.$route.path
}
},
methods: {
handleSelect (key, keyPath) {
} }
} }
} }
......
<template>
<span style="font-size: 200px">test1</span>
</template>
<script>
export default {
name: 'UserRole'
}
</script>
<style scoped>
</style>
<template> <template>
<div> <div>
<el-menu <el-menu
:default-active="'/index'" :default-active="currentPath"
router router
mode="horizontal" mode="horizontal"
background-color="white" background-color="white"
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
name: 'NavMenu', name: 'NavMenu',
data () { data () {
return { return {
// currentPath: this.$route.path,
navList: [ navList: [
{name: '/index', navItem: '首页'}, {name: '/index', navItem: '首页'},
{name: '/jotter', navItem: '笔记本'}, {name: '/jotter', navItem: '笔记本'},
...@@ -41,6 +42,9 @@ ...@@ -41,6 +42,9 @@
computed: { computed: {
hoverBackground () { hoverBackground () {
return '#ffd04b' return '#ffd04b'
},
currentPath () {
return this.$route.path
} }
}, },
methods: { methods: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册