share.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. export default {
  2. data() {
  3. return {
  4. }
  5. },
  6. onLoad: function() {
  7. wx.showShareMenu({
  8. withShareTicket: true,
  9. menus: ["shareAppMessage", "shareTimeline"]
  10. })
  11. },
  12. onShareAppMessage(res) {
  13. console.log(1111)
  14. let that = this;
  15. // let imageUrl = that.shareUrl || '';
  16. let imageUrl = 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/min1.png'
  17. if (res.from === 'button') {
  18. console.log(2222)
  19. //这块需要传参,不然链接地址进去获取不到数据
  20. // let path = `/` + that.$scope.route + `?item=` + that.$scope.options.item;
  21. let path = `/pages/cardHolder/scanCodeAddCard`
  22. return {
  23. title: '商品分享~',
  24. path: path,
  25. imageUrl: imageUrl,
  26. content:'这里是分享内容啊!',
  27. desc:"这里是自定义描述啊!"
  28. };
  29. }
  30. if (res.from === 'menu') {
  31. return {
  32. title: '商通线上商城',
  33. path: '/pages/tabBarPro/index/index',
  34. imageUrl: imageUrl
  35. };
  36. }
  37. },
  38. // 分享到朋友圈
  39. onShareTimeline() {
  40. return {
  41. title: '名片box',
  42. path: '/pages/cardHolder/cardHolder',
  43. imageUrl: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/pcfiles/%E5%90%8D%E7%89%87box.png'
  44. };
  45. },
  46. methods: {
  47. }
  48. }