2.1.11 • Published 4 years ago
lbweb-react v2.1.11
lbweb-react
安装
npm install --save lbweb-react
npm install --save react-router-dom history
使用
routes.tsx
import { RouteItem, useRoutes } from 'lbweb-react'
const routes: Array<RouteItem> = [
{
path: '/',
name: '根路径',
redirect: '/home',
},
{
path: '*',
name: 'BaseLayout',
element: <BaseLayout></BaseLayout>,
children: [
{
path: '/home',
name: '首页',
element: <div>首页</div>,
before: async () => {
console.log('进入首页')
},
},
],
},
{
path: '/login',
name: '登录',
element: <div>登录</div>,
},
{
path: '*',
name: '404',
element: <div>页面不存在</div>,
},
]
export const Routes = () => {
return useRoutes(routes)
}
index.tsx
import React, { Component } from 'react'
import { ConfigRouter } from 'lbweb-react'
import { Routes } from './routes'
function App() {
return (
<HashRouter>
<ConfigRouter>
<Routes></Routes>
</ConfigRouter>
</HashRouter>
)
}
ReactDOM.render(<App />, document.getElementById('root'))
License
MIT © lblblong
2.1.11
4 years ago
2.1.10
4 years ago
2.1.9
4 years ago
2.1.8
4 years ago
2.1.7
4 years ago
2.1.4
4 years ago
2.1.3
4 years ago
2.1.6
4 years ago
2.1.5
4 years ago
2.1.1
4 years ago
2.1.0
4 years ago
2.0.3
4 years ago
2.0.2
4 years ago
2.0.1
4 years ago
2.0.0
4 years ago
1.0.19
4 years ago
1.0.22
4 years ago
1.0.21
4 years ago
1.0.20
4 years ago
1.0.23
4 years ago
1.0.18
4 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.2
4 years ago
1.0.3
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago