share.js 729 B

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. const share = {
  3. data() {
  4. return {
  5. // 默认的全局分享内容
  6. share: {
  7. title: "标题",
  8. path: "/pages/home/home",
  9. // 这里是分享的页面
  10. imageUrl: ""
  11. // 这里是分析的图片,如果不写则默认截取当前分享页为分享图片
  12. }
  13. };
  14. },
  15. // 定义全局分享
  16. // 1.发送给朋友
  17. onShareAppMessage(res) {
  18. return {
  19. title: this.share.title,
  20. path: this.share.path,
  21. imageUrl: this.share.imageUrl
  22. };
  23. },
  24. //2.分享到朋友圈
  25. onShareTimeline(res) {
  26. return {
  27. title: this.share.title,
  28. path: this.share.path,
  29. imageUrl: this.share.imageUrl
  30. };
  31. }
  32. };
  33. exports.share = share;