feat(menu): 新增菜单自定义样式配置功能
1. 新增菜单样式表单字段,支持传入JSON格式自定义菜单样式 2. 改造侧边栏组件,实现菜单样式的动态绑定与渲染 3. 添加路由元信息style字段的解析与调试日志 4. 修复侧边栏菜单默认样式冲突问题
This commit is contained in:
@@ -44,6 +44,18 @@ const permission = {
|
||||
return new Promise(resolve => {
|
||||
// 向后端请求路由数据
|
||||
getRouters().then(res => {
|
||||
// 调试:检查后端路由数据
|
||||
const logMetaStyle = (arr, depth = 0) => {
|
||||
arr.forEach(item => {
|
||||
const title = (item.meta && item.meta.title) || item.name || ''
|
||||
const styleVal = item.meta && item.meta.style
|
||||
console.log('[permission] depth=' + depth, title, 'meta.style=', styleVal)
|
||||
if (item.children) logMetaStyle(item.children, depth + 1)
|
||||
})
|
||||
}
|
||||
console.log('[permission] === getRouters 原始数据 ===')
|
||||
logMetaStyle(res.data)
|
||||
console.log('[permission] === getRouters 数据结束 ===')
|
||||
const sdata = JSON.parse(JSON.stringify(res.data))
|
||||
const rdata = JSON.parse(JSON.stringify(res.data))
|
||||
const sidebarRoutes = filterAsyncRouter(sdata)
|
||||
|
||||
Reference in New Issue
Block a user