mp-share.js 568 B

1234567891011121314151617181920212223242526272829303132
  1. // #ifdef H5
  2. import { runningInsideWeChat } from '@/platform/h5-wechat'
  3. // #endif
  4. export default {
  5. onLoad() {
  6. this.mpShare = {
  7. title: '',
  8. path: '',
  9. imageUrl: ''
  10. }
  11. // #ifdef MP-WEIXIN
  12. wx.showShareMenu({
  13. withShareTicket: true,
  14. menus: ['shareAppMessage', 'shareTimeline']
  15. })
  16. // #endif
  17. // #ifdef MP-QQ
  18. qq.showShareMenu({
  19. showShareItems: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
  20. })
  21. // #endif
  22. },
  23. onShareAppMessage() {
  24. return this.mpShare
  25. },
  26. // #ifdef MP-WEIXIN
  27. onShareTimeline() {
  28. return this.mpShare
  29. }
  30. // #endif
  31. }