Commit 2f1c62b4 by Wee

docs: update readme

parent 8cd9ff2a
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<a href="https://circleci.com/gh/fi3ework/react-live-route"> <a href="https://circleci.com/gh/fi3ework/react-live-route">
<img src="https://img.shields.io/circleci/project/github/fi3ework/react-live-route/master.svg?style=flat-square" alt="Build Status"> <img src="https://img.shields.io/circleci/project/github/fi3ework/react-live-route/master.svg?style=flat-square" alt="Build Status">
</a> </a>
<a href='https://coveralls.io/github/fi3ework/tinar?branch=master'><img src='https://coveralls.io/repos/github/fi3ework/tinar/badge.svg?branch=master&amp;t=CTNsds' alt='Coverage Status' /></a> <a href='https://coveralls.io/github/fi3ework/react-live-route'><img src='https://img.shields.io/coveralls/github/fi3ework/react-live-route/master.svg?style=flat-square' alt='Coverage Status' /></a>
</i> </i>
</p> </p>
</p> </p>
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
[中文](./docs/README-zh.md) [中文](./docs/README-zh.md)
## Feedback
Feel free to open an [issue](https://github.com/fi3ework/react-live-route/issues/new) to ask for help or have a discussion. If there is a detailed code problem help is needed, please fork [this](https://codesandbox.io/s/20pm25081r) minimal demo to provide a reproduce scenario, or your issue might be closed directly due to lack of information.
## Demo ## Demo
### codeSandbox ### codeSandbox
...@@ -81,9 +85,9 @@ Example: ...@@ -81,9 +85,9 @@ Example:
The route of List will be rendered normally under `/list`, and it will be hidden when location change to `/user/:id`, and it will be unmounted normally when entering other locations. The route of List will be rendered normally under `/list`, and it will be hidden when location change to `/user/:id`, and it will be unmounted normally when entering other locations.
```jsx ```tsx
import LiveRoute from 'react-live-route' import LiveRoute from 'react-live-route'
;<LiveRoute path="/list" livePath="/user/:id" component={List} /> <LiveRoute path="/list" livePath="/user/:id" component={List} />
``` ```
### alwaysLive: bool ### alwaysLive: bool
...@@ -96,7 +100,7 @@ After the first mount on match location, the Modal page will be hidden when the ...@@ -96,7 +100,7 @@ After the first mount on match location, the Modal page will be hidden when the
```jsx ```jsx
import LiveRoute from 'react-live-route' import LiveRoute from 'react-live-route'
;<LiveRoute path="/list" alwaysLive={true} component={Modal} /> <LiveRoute path="/list" alwaysLive={true} component={Modal} />
``` ```
### onHide: (routeState: {location, livePath, alwaysLive}) => any ### onHide: (routeState: {location, livePath, alwaysLive}) => any
...@@ -109,7 +113,7 @@ This hook will be triggered when LiveRoute will reappear from hide in `component ...@@ -109,7 +113,7 @@ This hook will be triggered when LiveRoute will reappear from hide in `component
```js ```js
import LiveRoute from 'react-live-route' import LiveRoute from 'react-live-route'
;<LiveRoute <LiveRoute
path="/items" path="/items"
component={List} component={List}
livePath="/item/:id" livePath="/item/:id"
...@@ -125,8 +129,9 @@ import LiveRoute from 'react-live-route' ...@@ -125,8 +129,9 @@ import LiveRoute from 'react-live-route'
/> />
``` ```
## TODO ## Todo
- [ ] support render
- [ ] add forceUnmount prop - [ ] add forceUnmount prop
## Licence ## Licence
......
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
[English](../README.md) [English](../README.md)
## 反馈
欢迎开 [issue](https://github.com/fi3ework/react-live-route/issues/new) 来获取帮助或讨论。如果需要帮助,请 fork [这个](https://codesandbox.io/s/20pm25081r)最小化的代码来复现有问题的场景,否则你的 issue 可能会因为缺少信息而被直接关闭。
## Demo ## Demo
### codeSandbox ### codeSandbox
...@@ -67,7 +71,6 @@ List 的路由会在 `/list` 下正常渲染,当进入 `/user/:id` 时会隐 ...@@ -67,7 +71,6 @@ List 的路由会在 `/list` 下正常渲染,当进入 `/user/:id` 时会隐
```jsx ```jsx
import LiveRoute from 'react-live-route' import LiveRoute from 'react-live-route'
<LiveRoute path="/list" livePath="/user/:id" component={List}/> <LiveRoute path="/list" livePath="/user/:id" component={List}/>
``` ```
...@@ -79,7 +82,6 @@ import LiveRoute from 'react-live-route' ...@@ -79,7 +82,6 @@ import LiveRoute from 'react-live-route'
```jsx ```jsx
import LiveRoute from 'react-live-route' import LiveRoute from 'react-live-route'
<LiveRoute path="/list" alwaysLive={true} component={Modal}/> <LiveRoute path="/list" alwaysLive={true} component={Modal}/>
``` ```
......
{ {
"name": "react-live-route", "name": "react-live-route",
"version": "1.3.0", "version": "1.3.1",
"description": "A living route for react-router v4", "description": "A living route for react-router v4",
"repository": "fi3ework/react-live-route", "repository": "fi3ework/react-live-route",
"license": "MIT", "license": "MIT",
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"scripts": { "scripts": {
"build": "rm -fr dist && tsc", "build": "rm -fr dist && tsc",
"dev": "tsc -b -w --pretty", "dev": "tsc -b -w --pretty",
"prepare": "npm run build", "prepublishOnly": "npm run build",
"lint": "tslint src", "lint": "tslint src",
"test": "jest --coverage", "test": "jest --coverage",
"test:watch": "jest --watch" "test:watch": "jest --watch"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment