1.3.9 • Published 3 years ago
@wonder-ui/router v1.3.9
@wonder-ui/router
基于react-router-dom@5
封装的 moble-router
npm install --save @wonder-ui/router
Example
import * as React from 'react';
import { HashRouter as Router, Routes } from '@wonder-ui/router';
export default function App(){
return (
<HashRouter>
<Routes routes={[
{
path: '/index',
//component: Welcome,
//async: () => Promise<Welcome>
element: <Welcome/>,
children: [
{
path: 'citys',
async: ()=>import('./pages/Citys')
},
{
path: 'picker',
async: ()=>import('./pages/Picker')
},
]
},
]}/>
</HashRouter>
)
}
export interface PartialRouteObject {
path: string;
exact?: boolean;
element?: React.ReactNode;
component?: React.ComponentType;
async?: () => Promise<React.ComponentType>;
children?: PartialRouteObject[];
}
export interface RoutesProps {
routes: PartialRouteObject[];
animation?: 'slide' | 'fade' | 'scale';
animationDisabled?: boolean;
noMatch?: React.ReactNode;
onRouteChange?: (location: Location, action: string) => void;
}
hooks
export interface Location {
hash?: string;
query?: object;
search?: string;
pathname: string;
state?: any;
}
export function useLocation(): Location;
export function useLocationExact(): Location;
export function usePageEffect(
callback: () => (() => any) | void,
vars: any[]
): void;
export function useNavigation(): {
goBack: () => void;
goForward: () => void;
push: (loc: string | Partial<Location>, state?: any) => void;
replace: (loc: string | Partial<Location>, state?: any) => void;
};
其他
react-router : https://reactrouter.com/web/api/Hooks
1.3.9
3 years ago
1.0.4
3 years ago
1.3.8
3 years ago
1.0.3
3 years ago
1.3.7
3 years ago
1.3.6
3 years ago
1.3.5
3 years ago
1.3.4
3 years ago
1.3.3
3 years ago
1.3.2
3 years ago
1.3.1
3 years ago
1.3.0
3 years ago
0.0.24
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.0.23
4 years ago
0.0.22
4 years ago
0.0.21
4 years ago
0.0.20
4 years ago
0.0.19
4 years ago
0.0.18
4 years ago
0.0.17
4 years ago
0.0.16
4 years ago
0.0.15
4 years ago
0.0.14
5 years ago
0.0.13
5 years ago
0.0.12
5 years ago
0.0.11
5 years ago
0.0.10
5 years ago
0.0.9
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago