@ztjk/router
v0.0.11
Published
路由组件
Downloads
11
Readme
@ztjk/router
zt路由封装
使用
import { HashRouter,useRoutes } from 'react-router-dom';
import {syncRouter,btnHasAuthority,Access} from "@ztjk/router";
const Routes = [
{
path: "/",
redirect: "/index",
},
{
path: "/",
hideInMenu: true,
component: "components/xhead/index",
children: [
{
name: "用户管理",
icon: "zt-jichushuju",
hideInMenu: true,
access: "用户管理",
path: "/index",
children: [
{
name: "首页",
hideInMenu: true,
access: "",
path: "/index",
component: "pages/index/index",
}
],
}
],
},
{
name: "404",
path: "*",
component: 'pages/404'
}
];
const App = () => {
const Main = () => useRoutes(syncRouter(Routes,(path)=>{return import( ('@/'+ path))}));
return <>
<HashRouter>
<Main />
</HashRouter>
</>
}
export default App;
API
syncRouter 路由守卫方法
btnHasAuthority 用户权限判断方法
Access 按钮权限判断