c-uview-plus
Version:
零云®uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水
27 lines (25 loc) • 793 B
JavaScript
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