0.0.10 • Published 5 months ago

@ztjk/router v0.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

@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 按钮权限判断

0.0.10

5 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago