import config from '@/core/config/index.js' export default { data() { return { share: { // 转发的标题 (默认标题) title: config.get('name'), // 默认是当前页面,必须是以‘/’开头的完整路径 path: `/pages/home/index`, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径, //支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 imageUrl: config.getResource('logo.png') } } }, // 发送给朋友 onShareAppMessage(res) { let shareInfo = uni.getStorageSync('shareInfo') return { title: shareInfo.title || this.share.title, imageUrl: shareInfo.imgUrl || this.share.imageUrl, path: shareInfo.path || this.share.path } }, //分享到朋友圈 onShareTimeline(res) { let shareInfo = uni.getStorageSync('shareInfo') return { title: shareInfo.title || this.share.title, imageUrl: shareInfo.imgUrl || this.share.imageUrl, path: shareInfo.path || this.share.path } } }