share.js 839 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import config from '../config.js';
  2. export default {
  3. data() {
  4. return {
  5. share: {
  6. title: config.point_title,
  7. path: `/pages/index/index`,
  8. imageUrl: config.shareUrl,
  9. }
  10. }
  11. },
  12. onShareAppMessage(res) { //发送给朋友
  13. return {
  14. title: this.share.title,
  15. path: this.share.path,
  16. imageUrl: this.share.imageUrl,
  17. success(res) {
  18. uni.showToast({
  19. title: '分享成功'
  20. })
  21. },
  22. fail(res) {
  23. uni.showToast({
  24. title: '分享失败',
  25. icon: 'none'
  26. })
  27. }
  28. }
  29. },
  30. onShareTimeline(res) { //分享到朋友圈
  31. return {
  32. title: this.share.title,
  33. path: this.share.path,
  34. imageUrl: this.share.imageUrl,
  35. success(res) {
  36. uni.showToast({
  37. title: '分享成功'
  38. })
  39. },
  40. fail(res) {
  41. uni.showToast({
  42. title: '分享失败',
  43. icon: 'none'
  44. })
  45. }
  46. }
  47. },
  48. }