Skip to content
Permalink
Browse files

fix(taro-alipay): fix 子组件 componentWillRecieveProps 不会触发

  • Loading branch information...
luckyadam committed Oct 16, 2018
1 parent 629a06f commit db236dd049fc0ff71e5535080c962a1c274dd6ed
Showing with 3 additions and 0 deletions.
  1. +3 −0 packages/taro-alipay/src/lifecycle.js
@@ -9,6 +9,7 @@ import PropTypes from 'prop-types'
const isDEV = typeof process === 'undefined' ||
!process.env ||
process.env.NODE_ENV !== 'production'
const privatePropKeyName = '_triggerObserer'

export function updateComponent (component) {
const { props, __propTypes } = component
@@ -61,6 +62,7 @@ function doUpdate (component, prevProps, prevState) {
// 返回null或undefined则保持不变
data = component._createData(state, props) || data
}
let privatePropKeyVal = component.$scope.data[privatePropKeyName] || false

data = Object.assign({}, props, data)
if (component.$usedState && component.$usedState.length) {
@@ -81,6 +83,7 @@ function doUpdate (component, prevProps, prevState) {
})
data = _data
}
data[privatePropKeyName] = !privatePropKeyVal
const dataDiff = diffObjToPath(data, component.$scope.data)
component.$scope.setData(dataDiff, function () {
if (component.__mounted && typeof component.componentDidUpdate === 'function') {

0 comments on commit db236dd

Please sign in to comment.
You can’t perform that action at this time.