shareMixin.js 753 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // 创建全局mixin
  2. export default {
  3. onLoad() {
  4. // 开启分享功能
  5. uni.showShareMenu({
  6. withShareTicket: true,
  7. menus: ['shareAppMessage', 'shareTimeline']
  8. })
  9. },
  10. onShareAppMessage() {
  11. return {
  12. title: this.shareTitle || '云飞智控',
  13. path: this.sharePath || '/pages/index/index',
  14. imageUrl: this.shareImage || ''
  15. }
  16. },
  17. // 朋友圈
  18. onShareTimeline() {
  19. return {
  20. title: this.timelineTitle || '云飞智控',
  21. query: this.timelineQuery || '',
  22. imageUrl: this.timelineImage || ''
  23. }
  24. },
  25. data() {
  26. return {
  27. shareTitle: '',
  28. sharePath: '',
  29. shareImage: '',
  30. timelineTitle: '',
  31. timelineQuery: '',
  32. timelineImage: ''
  33. }
  34. }
  35. }