Skip to content

Commit

Permalink
fix(taro): 执行完componentWillMount后需要设置组件状态
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Apr 23, 2018
1 parent 14bbbfe commit b065e57
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/taro/src/create-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ function componentTrigger (component, key) {
componentTrigger(component.$$components[name], key)
})
component[key] && typeof component[key] === 'function' && component[key]()
if (key === 'componentWillMount') {
component._dirty = false
component._disable = false
component.state = component.getState()
}
}

function createPage (PageClass) {
Expand All @@ -115,8 +120,6 @@ function createPage (PageClass) {
params: options
}
componentTrigger(page, 'componentWillMount')
page._dirty = false
page._disable = false
},
onReady () {
componentTrigger(page, 'componentDidMount')
Expand Down

0 comments on commit b065e57

Please sign in to comment.