diff --git a/packages/taro-weapp/src/lifecycle.js b/packages/taro-weapp/src/lifecycle.js index dc05b54443be..70bb0f7db87e 100644 --- a/packages/taro-weapp/src/lifecycle.js +++ b/packages/taro-weapp/src/lifecycle.js @@ -62,7 +62,8 @@ function doUpdate (component, prevProps, prevState) { let data = state || {} if (component._createData) { // 返回null或undefined则保持不变 - data = component._createData(state, props) || data + const runloopRef = !component.__mounted + data = component._createData(state, props, runloopRef) || data } let privatePropKeyVal = component.$scope.data[privatePropKeyName] || false @@ -117,6 +118,10 @@ function doUpdate (component, prevProps, prevState) { }) } + if (component['$$hasLoopRef']) { + component._createData(component.state, component.props) + } + if (typeof component.componentDidUpdate === 'function') { component.componentDidUpdate(prevProps, prevState) }