|
|
@ -1,5 +1,5 @@ |
|
|
|
<template> |
|
|
|
<el-menu :default-active="leftIndex" class="el-menu-demo" mode="vertical" @select="handleSelect"> |
|
|
|
<el-menu :default-active="data.menuIndex" class="el-menu-demo" mode="vertical" @select="handleSelect"> |
|
|
|
<el-menu-item :disabled="list.disabled" :index="index" @click="openPage(list.name)" v-for="(list, index) in data.menus" :key="index"> |
|
|
|
{{ list.title }} |
|
|
|
</el-menu-item> |
|
|
@ -8,7 +8,7 @@ |
|
|
|
|
|
|
|
<script setup> |
|
|
|
import { useStore } from 'vuex'; |
|
|
|
import { reactive, computed } from 'vue'; |
|
|
|
import { reactive, computed, watchEffect } from 'vue'; |
|
|
|
import { useRouter } from 'vue-router'; |
|
|
|
|
|
|
|
const store = useStore(); |
|
|
@ -23,6 +23,15 @@ const data = reactive({ |
|
|
|
{ title: '我的业务', name: 'desk-business-list', disabled: false }, |
|
|
|
{ title: '我的插件', name: 'desk-plugin-list', disabled: false }, |
|
|
|
], |
|
|
|
menuIndex: '', |
|
|
|
}); |
|
|
|
|
|
|
|
console.log('menuIndex: ', data.menuIndex); |
|
|
|
watchEffect(() => { |
|
|
|
if (leftIndex && leftIndex.value) { |
|
|
|
data.menuIndex = leftIndex.value; |
|
|
|
console.log('data.menuIndex: ', data.menuIndex); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
function handleSelect(e) { |
|
|
@ -31,7 +40,6 @@ function handleSelect(e) { |
|
|
|
|
|
|
|
// 点击跳转路由 |
|
|
|
function openPage(name) { |
|
|
|
console.log('name: ', name); |
|
|
|
router.push({ name }); |
|
|
|
} |
|
|
|
</script> |
|
|
|