Skip to content

Commit

Permalink
fix(router): h5路由方法执行顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed May 28, 2018
1 parent e1a7fb5 commit 1f445e0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/taro-router/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,18 @@ const getWrappedComponent = (component, { location }) => {
}

componentDidMount () {
super.componentDidMount && super.componentDidMount()
super.componentDidShow && super.componentDidShow()
let nextStatus = this.props.location.pageId === this.pageId ? 2 : 1
if (this.__pageStatus === nextStatus) return
if (this.__pageStatus === nextStatus) {
super.componentDidMount && super.componentDidMount()
super.componentDidShow && super.componentDidShow()
return
}
setTimeout(() => {
this.__pageStatus = 2
this.defaultShow = true
this.forceUpdate()
super.componentDidMount && super.componentDidMount()
super.componentDidShow && super.componentDidShow()
}, 100)
}

Expand Down Expand Up @@ -125,7 +129,7 @@ const getWrappedComponent = (component, { location }) => {
}

const getCurrentPages = function (opts) {
return history.stack[0]
return history.now()
}

/**
Expand Down

0 comments on commit 1f445e0

Please sign in to comment.