Skip to content

Commit

Permalink
fix(taro-weapp): 初始化阶段不触发 componentDidUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Oct 19, 2018
1 parent 7ea23c5 commit 7a2685c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/taro-weapp/src/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ function doUpdate (component, prevProps, prevState) {
// 改变这个私有的props用来触发(observer)子组件的更新
data[privatePropKeyName] = !privatePropKeyVal
const dataDiff = diffObjToPath(data, component.$scope.data)
const __mounted = component.__mounted
component.$scope.setData(dataDiff, function () {
if (component.__mounted && typeof component.componentDidUpdate === 'function') {
if (__mounted && typeof component.componentDidUpdate === 'function') {
component.componentDidUpdate(prevProps, prevState)
}

Expand Down

0 comments on commit 7a2685c

Please sign in to comment.