share.js 831 B

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