// 定义全局分享 export default { data() { return { // 默认的全局分享内容 share: { title: '小神仙妆造预约', path: '', // 全局分享的路径 留空则默认截取当前页面 imageUrl: '', // 全局分享的图片(可本地可网络) 留空则默认截取当前页面 } } }, // 1.发送给朋友 onShareAppMessage(res) { const userInfo = uni.getStorageSync('userInfo') return { title: this.share.title, path: this.share.path, imageUrl: this.share.imageUrl, } }, // 2.分享到朋友圈 onShareTimeline(res) { const userInfo = uni.getStorageSync('userInfo') return { title: this.share.title, path: this.share.path, imageUrl: this.share.imageUrl, } }, }