// 定义全局分享 export default { data() { return { // 默认的全局分享内容 share: { title: '分享标题', path: '/pages/global', // 全局分享的路径 imageUrl: 'https://sbc.itanzhu.com/uploads/logo.png', // 全局分享的图片(可本地可网络) } } }, // 1.发送给朋友 onShareAppMessage(res) { const userInfo = uni.getStorageSync('userInfo') return { title: this.share.title, path: this.share.path + '?userId=' + userInfo.userid, imageUrl: this.share.imageUrl, } }, // 2.分享到朋友圈 onShareTimeline(res) { const userInfo = uni.getStorageSync('userInfo') return { title: this.share.title, path: this.share.path + '?userId=' + userInfo.userid, imageUrl: this.share.imageUrl, } }, }