diff --git a/packages/taro-components/src/components/tabbar/index.js b/packages/taro-components/src/components/tabbar/index.js index 9b127e235faf..c7ccf8b77f1d 100644 --- a/packages/taro-components/src/components/tabbar/index.js +++ b/packages/taro-components/src/components/tabbar/index.js @@ -97,11 +97,9 @@ class Tabbar extends Nerv.Component { const { conf, router = {} } = this.props function handleSelect (index, e) { let list = this.state.list - router.navigateTo && - router.navigateTo({ - url: - (/^\//.test(list[index].pagePath) ? '' : '/') + list[index].pagePath - }) + router.redirectTo && router.redirectTo({ + url: (/^\//.test(list[index].pagePath) ? '' : '/') + list[index].pagePath + }) } conf.borderStyle = conf.borderStyle || 'black' let containerCls = classNames('weui-tabbar', { diff --git a/packages/taro-router/src/router/route.tsx b/packages/taro-router/src/router/route.tsx index a0bfc0547671..5540f56cc6d8 100644 --- a/packages/taro-router/src/router/route.tsx +++ b/packages/taro-router/src/router/route.tsx @@ -66,8 +66,8 @@ class Route extends Component { this.props.collectComponent(ref, this.props.k) } - updateComponent () { - this.props.componentLoader() + updateComponent (props = this.props) { + props.componentLoader() .then(({ default: component }) => { let WrappedComponent = createWrappedComponent(component) this.wrappedComponent = WrappedComponent @@ -85,12 +85,14 @@ class Route extends Component { } componentWillReceiveProps (nProps, nContext) { - if (this.props.path !== nProps.path) this.updateComponent() - const lastMatched = this.matched const nextMatched = this.computeMatch(nProps.currentLocation) - if (lastMatched === nextMatched) return + if (this.props.path !== nProps.path) { + this.updateComponent(nProps) + } else if (lastMatched === nextMatched) { + return + } this.matched = nextMatched