Skip to content

Commit

Permalink
fix(taro-alipay): 修复支付宝小程序 componentWillUnmount 报错的问题,close #3167
Browse files Browse the repository at this point in the history
支付宝小程序页面对象不存在 props 属性,所以取 props.compid 前需要先判断是否存在 props。
  • Loading branch information
Chen-jj committed May 27, 2019
1 parent 856fb63 commit ea1764e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/taro-alipay/src/create-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,10 @@ export function componentTrigger (component, key, args) {
}

if (key === 'componentWillUnmount') {
const compid = component.$scope.props.compid
if (compid) propsManager.delete(compid)
if (component.$scope.props) {
const compid = component.$scope.props.compid
if (compid) propsManager.delete(compid)
}
}

component[key] && typeof component[key] === 'function' && component[key](...args)
Expand Down

0 comments on commit ea1764e

Please sign in to comment.