You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
767 B

5 months ago
  1. import { defineMixin } from '../vue'
  2. import { queryParams } from '../function/index'
  3. export const mpShare = defineMixin({
  4. data() {
  5. return {
  6. mpShare: {
  7. title: '', // 默认为小程序名称
  8. path: '', // 默认为当前页面路径
  9. imageUrl: '' // 默认为当前页面的截图
  10. }
  11. }
  12. },
  13. async onLoad(options) {
  14. var pages = getCurrentPages();
  15. var page = pages[pages.length - 1];
  16. this.mpShare.path = page.route + queryParams(options);
  17. },
  18. onShareAppMessage(res) {
  19. if (res.from === 'button') {// 来自页面内分享按钮
  20. console.log(res.target)
  21. }
  22. return this.mpShare;
  23. }
  24. })
  25. export default mpShare