小程序,定义函数调用onShareAppMessage

小程序开发中,已经定义过onShareAppMessage,希望点击图片(不是按钮)就可以调用分享,结果不可以。
tapShare:function(){
this.onShareAppMessage()
}
请问如何正确调用

不是这样定义的,onShareAppMessage(){} 这个是写在page 里面。 页面用button type='share' 就可以了

不是这样定义的,你可以百度一下它的例程,有很多的

页面用button type='share'

onShareAppMessage(){} 这个是写在page 里面。 页面用button type='share' 就可以了

页面用button type='share' 就可以了

页面用分享

page里面用button type='share'

按照你的这种需求 我通常都是在图片上放一个透明的按钮来实现大小和图片保持一致 通过RGBA控制透明 这样就达到了你要的点击图片分享的效果了