Commit 71d1e83b by fukai

支持live route

parent c2c337c0
{
"presets":["env","react"]
}
\ No newline at end of file
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
# misc
.DS_Store
npm-debug.log*
yarn-error.log
.vscode
/coverage
.idea
package-lock.json
.svn
.history
# outputs
dist/
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"react": "^16.2.0", "react": "^16.2.0",
"react-dom": "^16.2.0", "react-dom": "^16.2.0",
"react-intl": "^2.7.2", "react-intl": "^2.7.2",
"react-live-route": "^1.2.4",
"react-router-dom": "^4.2.2" "react-router-dom": "^4.2.2"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -21,7 +21,7 @@ export default class Pxiame extends Component ...@@ -21,7 +21,7 @@ export default class Pxiame extends Component
this.state = {loading:false} this.state = {loading:false}
} }
async componentDidMount() async componentWillMount()
{ {
const rtnmsg =await Api.post('/pxiame/init',{params:{pxiinr:this.props.match.params.id}}) const rtnmsg =await Api.post('/pxiame/init',{params:{pxiinr:this.props.match.params.id}})
......
...@@ -167,7 +167,7 @@ export default class Pxisel extends Component ...@@ -167,7 +167,7 @@ export default class Pxisel extends Component
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<Table loading={this.state.loading} dataSource={this.pxilst} columns={this.pxilst_column} /> <Table rowKey="inr" loading={this.state.loading} dataSource={this.pxilst} columns={this.pxilst_column} />
</Form> </Form>
</Fragment> </Fragment>
) )
......
import React,{Component} from 'react' import React,{Component} from 'react'
import { Switch, Route, Redirect } from 'react-router-dom'; import { Switch, Route, Redirect } from 'react-router-dom';
import LiveRoute from 'react-live-route'
import Pxiame from './Pxiame' import Pxiame from './Pxiame'
import Pxisel from './Pxisel' import Pxisel from './Pxisel'
import Pxiadd from './Pxiadd' import Pxiadd from './Pxiadd'
...@@ -11,10 +12,10 @@ const moduleBasePath = "/business/pxi/" ...@@ -11,10 +12,10 @@ const moduleBasePath = "/business/pxi/"
export default function moduleRouter(props){ export default function moduleRouter(props){
return <React.Fragment> return <React.Fragment>
<Switch>
<Route exact path={`${moduleBasePath}ame/:id`} component={Pxiame} /> <Route exact path={`${moduleBasePath}ame/:id`} component={Pxiame} />
<Route exact path={`${moduleBasePath}sel`} component={Pxisel} /> <LiveRoute exact path={`${moduleBasePath}sel`} livePath={`${moduleBasePath}ame/:id`} component={Pxisel} />
<Route exact path={`${moduleBasePath}add`} component={Pxiadd} /> <Route exact path={`${moduleBasePath}add`} component={Pxiadd} />
</Switch>
</React.Fragment> </React.Fragment>
} }
\ No newline at end of file
...@@ -5887,6 +5887,18 @@ react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4: ...@@ -5887,6 +5887,18 @@ react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4:
version "3.0.4" version "3.0.4"
resolved "http://registry.npm.taobao.org/react-lifecycles-compat/download/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" resolved "http://registry.npm.taobao.org/react-lifecycles-compat/download/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
react-live-route@^1.2.4:
version "1.2.4"
resolved "http://registry.npm.taobao.org/react-live-route/download/react-live-route-1.2.4.tgz#07d2363f5c5c7cfea69cb5dfeb4ec4169e343f20"
dependencies:
history "^4.7.2"
hoist-non-react-statics "^2.5.0"
invariant "^2.2.4"
loose-envify "^1.3.1"
path-to-regexp "^1.7.0"
prop-types "^15.6.1"
warning "^4.0.1"
react-proxy@^3.0.0-alpha.0: react-proxy@^3.0.0-alpha.0:
version "3.0.0-alpha.1" version "3.0.0-alpha.1"
resolved "http://registry.npm.taobao.org/react-proxy/download/react-proxy-3.0.0-alpha.1.tgz#4400426bcfa80caa6724c7755695315209fa4b07" resolved "http://registry.npm.taobao.org/react-proxy/download/react-proxy-3.0.0-alpha.1.tgz#4400426bcfa80caa6724c7755695315209fa4b07"
......
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