81c5e196b3 | ||
---|---|---|
.. | ||
src | ||
.gitignore | ||
LICENSE | ||
README.md | ||
package.json | ||
tsconfig.json | ||
tslint.json |
README.md
omi-ex
Omi.js ts extension by rainmanhhh
Install
npm i omi-ex
Usage
- Supports Router/Route(react-router like)
- Supports keepAlive
- Sharing data with subcomponents
- appData.routerData.query
- appData.routerData.params
- appData.routerData.data
import {RouterData} from 'omi-ex'
export class AppData {
abc: string = ''
passToChild: string = 'from parent'
routerData: RouterData = new RouterData()
}
export const appData = new AppData()
...
...
render(props: Omi.RenderableProps<AppProps>, data: AppData) {
return (
<div>
<div>
<a href={'#/'}>home</a>
<a href={'#/test'}>test</a>
</div>
<Router data={appData.routerData}>
<Route path={'/'} keepAlive={true}><Main/></Route>
<Route path={'/test'}><Test/></Route>
<Route path={'*'}>Not found</Route>
</Router>
</div>
)
}
...