From 449bdf1e9dd15aaf0df7fefb71f748428cf46822 Mon Sep 17 00:00:00 2001 From: chenjiajian <798095202@qq.com> Date: Tue, 19 Feb 2019 19:47:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(taro-weapp):=20=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=BE=AA=E7=8E=AF=20ref=20=E5=9C=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-transformer-wx/src/render.ts | 2 +- packages/taro-weapp/src/lifecycle.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/taro-transformer-wx/src/render.ts b/packages/taro-transformer-wx/src/render.ts index e91fab0145c0..53d3199f3d94 100644 --- a/packages/taro-transformer-wx/src/render.ts +++ b/packages/taro-transformer-wx/src/render.ts @@ -1665,7 +1665,7 @@ export class RenderParser { this.renderPath.node.body.body.unshift( template(`this.__state = arguments[0] || this.state || {};`)(), template(`this.__props = arguments[1] || this.props || {};`)(), - template(`const __runloopRef = arguments[2] || true;`)(), + template(`const __runloopRef = arguments[2];`)(), this.usedThisProperties.size ? t.variableDeclaration( 'const', diff --git a/packages/taro-weapp/src/lifecycle.js b/packages/taro-weapp/src/lifecycle.js index 70bb0f7db87e..4fd8f50d96f2 100644 --- a/packages/taro-weapp/src/lifecycle.js +++ b/packages/taro-weapp/src/lifecycle.js @@ -62,8 +62,8 @@ function doUpdate (component, prevProps, prevState) { let data = state || {} if (component._createData) { // 返回null或undefined则保持不变 - const runloopRef = !component.__mounted - data = component._createData(state, props, runloopRef) || data + const runLoopRef = !component.__mounted + data = component._createData(state, props, runLoopRef) || data } let privatePropKeyVal = component.$scope.data[privatePropKeyName] || false @@ -119,7 +119,7 @@ function doUpdate (component, prevProps, prevState) { } if (component['$$hasLoopRef']) { - component._createData(component.state, component.props) + component._createData(component.state, component.props, true) } if (typeof component.componentDidUpdate === 'function') {