Skip to content

Commit

Permalink
fix(runtime): 类组件不需要配置 enableShareAppMessage enableShareTimeline, #7056
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jul 15, 2020
1 parent 022a624 commit 2f83f7b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/taro-runtime/src/dsl/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ export function createPageConfig (component: any, pageName?: string, data?: Reco
}

// onShareAppMessage 和 onShareTimeline 一样,会影响小程序右上方按钮的选项,因此不能默认注册。
if (component.onShareAppMessage || component.enableShareAppMessage) {
if (component.onShareAppMessage
|| component.prototype.onShareAppMessage
|| component.enableShareAppMessage) {
config.onShareAppMessage = function (options) {
const target = options.target
if (target != null) {
Expand All @@ -228,7 +230,9 @@ export function createPageConfig (component: any, pageName?: string, data?: Reco
return safeExecute(path, 'onShareAppMessage', options)
}
}
if (component.onShareTimeline || component.enableShareTimeline) {
if (component.onShareTimeline
|| component.prototype.onShareTimeline
|| component.enableShareTimeline) {
config.onShareTimeline = function () {
const path = getPath(id, this.options)
return safeExecute(path, 'onShareTimeline')
Expand Down

0 comments on commit 2f83f7b

Please sign in to comment.