|
|
|
@ -13,14 +13,31 @@ import SettingsIcon from '@/assets/blue.png'; |
|
|
|
// 使用import.meta.glob导入所有SVG图标(修复版本) |
|
|
|
const icons = import.meta.glob('@/assets/SvgIcons/*.svg', { eager: true }) |
|
|
|
|
|
|
|
// import from '@/assets/SvgIcons/workbench.svg' |
|
|
|
// import from '@/assets/SvgIcons/activity.png' |
|
|
|
// import from '@/assets/SvgIcons/activity.png' |
|
|
|
// import from '@/assets/SvgIcons/activity.png' |
|
|
|
// import from '@/assets/SvgIcons/activity.png' |
|
|
|
|
|
|
|
|
|
|
|
const menuNameMap = { |
|
|
|
'工作台': 'workbench', |
|
|
|
'金币管理': 'goldManagement', |
|
|
|
'现金管理': 'cashManagement', |
|
|
|
'活动管理': 'activityManagement', |
|
|
|
'频道管理': 'channelManagement', |
|
|
|
'权限管理': 'permissionManagement', |
|
|
|
} |
|
|
|
|
|
|
|
// 创建获取图标路径的函数(修复版本) |
|
|
|
const getIconPath = (menuName) => { |
|
|
|
|
|
|
|
const englishName = menuNameMap[menuName] || menuName; |
|
|
|
|
|
|
|
// 构建可能的key格式 |
|
|
|
const possibleKeys = [ |
|
|
|
`@/assets/SvgIcons/${menuName}.svg`, |
|
|
|
`./SvgIcons/${menuName}.svg`, |
|
|
|
`/src/assets/SvgIcons/${menuName}.svg` |
|
|
|
`@/assets/SvgIcons/${englishName}.svg`, |
|
|
|
`./SvgIcons/${englishName}.svg`, |
|
|
|
`/src/assets/SvgIcons/${englishName}.svg` |
|
|
|
] |
|
|
|
|
|
|
|
// 在icons对象中查找对应的图标 |
|
|
|
@ -68,11 +85,6 @@ const refreshData = async () => { |
|
|
|
|
|
|
|
// --------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 存储接口返回的菜单数据 |
|
|
|
const menuList = ref([]) |
|
|
|
|
|
|
|
@ -110,9 +122,6 @@ function findBestMatch(menuList, path) { |
|
|
|
return bestMatch || path // fallback 到当前路径 |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 响应式高亮菜单 |
|
|
|
const activeMenu = computed(() => { |
|
|
|
return findBestMatch(menuList.value, route.path) |
|
|
|
|