wakaka623

1.在app.js定义方法

overShare: function () {
//监听路由切换
wx.onAppRoute(function (res) {
let pages = getCurrentPages(),
view = pages[pages.length - 1]
if (view) {
wx.showShareMenu({
withShareTicket: true,
menus: [\'shareAppMessage\', \'shareTimeline\']
})
}
})
},
 
2.在onLaunch钩子中调用方法
onLaunch: function () {
  this.overShare()
}

分类:

技术点:

相关文章: