|
@@ -1,27 +1,36 @@
|
|
|
<template>
|
|
<template>
|
|
|
<el-menu
|
|
<el-menu
|
|
|
- style="width: 220px; height: 100%"
|
|
|
|
|
:default-active="this.$store.state.currentMenuItem"
|
|
:default-active="this.$store.state.currentMenuItem"
|
|
|
- class="el-menu-vertical-demo"
|
|
|
|
|
|
|
+ style="width: 220px; height: 100%"
|
|
|
background-color="#141B29"
|
|
background-color="#141B29"
|
|
|
text-color="#fff"
|
|
text-color="#fff"
|
|
|
active-text-color="#ffd04b"
|
|
active-text-color="#ffd04b"
|
|
|
:router="true"
|
|
:router="true"
|
|
|
>
|
|
>
|
|
|
- <el-submenu v-for="item in menu" :key="item">
|
|
|
|
|
|
|
+ <el-submenu v-for="(item, index) in menu" :key="item" :index="index">
|
|
|
<template v-slot:title>
|
|
<template v-slot:title>
|
|
|
<i :class="item.icon"></i>
|
|
<i :class="item.icon"></i>
|
|
|
<span>{{ item.title }}</span>
|
|
<span>{{ item.title }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
- <el-menu-item v-for="son in item.items" :index="son.path" :key="son">
|
|
|
|
|
|
|
+ <el-menu-item
|
|
|
|
|
+ v-for="son in item.items"
|
|
|
|
|
+ :index="son.path"
|
|
|
|
|
+ :key="son"
|
|
|
|
|
+ @click="changeIndex(son.path)"
|
|
|
|
|
+ >
|
|
|
{{ son.name }}
|
|
{{ son.name }}
|
|
|
</el-menu-item>
|
|
</el-menu-item>
|
|
|
</el-submenu>
|
|
</el-submenu>
|
|
|
</el-menu>
|
|
</el-menu>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import { ref } from "vue";
|
|
|
export default {
|
|
export default {
|
|
|
setup() {
|
|
setup() {
|
|
|
|
|
+ let defaultActive = ref();
|
|
|
|
|
+ function changeIndex(path) {
|
|
|
|
|
+ defaultActive.value = path;
|
|
|
|
|
+ }
|
|
|
let menu = [
|
|
let menu = [
|
|
|
{
|
|
{
|
|
|
icon: "el-icon-s-unfold",
|
|
icon: "el-icon-s-unfold",
|
|
@@ -84,6 +93,8 @@ export default {
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
|
|
+ changeIndex,
|
|
|
|
|
+ defaultActive,
|
|
|
menu,
|
|
menu,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|