提交 edbb10d5 编写于 作者: 雪洛's avatar 雪洛

fix: 修复支付宝小程序sjs中callMethod不能正确调用的Bug

上级 e27b5f0b
......@@ -126,6 +126,14 @@ export default function parseComponent (vueComponentOptions) {
componentOptions.deriveDataFromProps = createObserver()
} else {
componentOptions.didUpdate = createObserver(true)
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
componentOptions.methods[callMethod] = function (args) {
return this.$vm[callMethod](args)
}
})
}
return componentOptions
......
......@@ -77,6 +77,14 @@ export default function parsePage (vuePageOptions) {
}
initHooks(pageOptions, hooks, vuePageOptions)
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
pageOptions[callMethod] = function (args) {
return this.$vm[callMethod](args)
}
})
}
return pageOptions
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册