接口获取动态菜单
This commit is contained in:
parent
98ad5d16f4
commit
19a76015bd
|
|
@ -1,8 +1,8 @@
|
|||
# 开发环境标识(Vite 内置变量,无需修改)
|
||||
NODE_ENV = development
|
||||
|
||||
# 开发环境接口基础地址(对应你配置的 192.168.10.10:8085/api)
|
||||
VITE_API_BASE_URL = http://192.168.10.10:8085/api
|
||||
# 开发环境接口基础地址(192.168.11.183:8085/api)
|
||||
VITE_API_BASE_URL = http://192.168.11.183:8085/api
|
||||
|
||||
# 请求超时时间(毫秒)
|
||||
VITE_REQUEST_TIMEOUT = 10000
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<!-- 菜单区域 -->
|
||||
<el-menu class="menu" :unique-opened="true" :default-active="activeMenu" router>
|
||||
<template v-for="menu in staticMenuList" :key="menu.id">
|
||||
<template v-for="menu in menuList" :key="menu.id">
|
||||
<!-- 无子菜单 -->
|
||||
<el-menu-item v-if="!menu.children || menu.children.length === 0" :index="menu.path">
|
||||
<el-icon>
|
||||
|
|
@ -50,7 +50,7 @@ const menuList = ref<any[]>([])
|
|||
|
||||
// 计算当前激活的菜单 index(取路由 fullPath 作为激活标识)
|
||||
const activeMenu = computed(() => {
|
||||
return route.fullPath // 直接使用完整路径,和你的菜单 path 保持一致
|
||||
return route.fullPath // 直接使用完整路径,和菜单 path 保持一致
|
||||
})
|
||||
// 组件挂载时异步加载菜单
|
||||
onMounted(async () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue