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

import { defineMixin } from '../vue'
import { queryParams } from '../function/index'
export const mpShare = defineMixin({
data() {
return {
mpShare: {
title: '', // 默认为小程序名称
path: '', // 默认为当前页面路径
imageUrl: '' // 默认为当前页面的截图
}
}
},
async onLoad(options) {
var pages = getCurrentPages();
var page = pages[pages.length - 1];
this.mpShare.path = page.route + queryParams(options);
},
onShareAppMessage(res) {
if (res.from === 'button') {// 来自页面内分享按钮
console.log(res.target)
}
return this.mpShare;
}
})
export default mpShare