Skip to content

Commit

Permalink
[add]案例:无权限时展示降级页面
Browse files Browse the repository at this point in the history
  • Loading branch information
wpgodforever committed May 3, 2024
1 parent 48521e8 commit 20b1464
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/MainMenu/sliderConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export const sliderConfig = [
label: 'hooks useContext',
path: '/case/useContext'
},
{
key: 34,
label: '无权限展示',
path: '/case/right'
},
]
}
]
Expand Down
8 changes: 8 additions & 0 deletions src/routers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const Test1 = lazy(() => import('../views/Test/test1.tsx'))
const UseRef = lazy(() => import('../views/Case/useRef.tsx'))
const UseEffect = lazy(() => import('../views/Case/useEffect.tsx'))
const UseContext = lazy(() => import('../views/Case/useContext.tsx'))
const Right = lazy(() => import('../views/Case/right.tsx'))

import { defaultAuthLoad } from './auth'

Expand Down Expand Up @@ -98,6 +99,13 @@ const routes = [
role: ['admin']
}),
},
{
path: '/case/right',
element: defaultAuthLoad(lazyLoading(<Right />), {
title: '无权限展示',
role: ['tester']
}),
},

]
},
Expand Down
9 changes: 9 additions & 0 deletions src/views/Case/right.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const right = () => {
return (
<div>
<h1>right</h1>
</div>
);
}

export default right;

0 comments on commit 20b1464

Please sign in to comment.