// utils/share.js
export default {
  onLoad() { // 创建时设置统一页面的默认值
    uni.$mpShare = {
      title: '爱愈膳汤铺',
      path: '/pages/index/index',
      imageUrl: 'https://file.aiyushantp.com/file/b22aa4e4625714e2747b15cfa174ea2351e59df4bacec69d338f9c87c7dae5ca.png' // 全局图片链接
    }
    uni.onCopyUrl((result) => {
      setTimeout(() => {
        uni.setClipboardData({
          data: "不可复制哦",
        });
      }, 1500);
    });
  },
  onShareAppMessage() { //发送给朋友
    console.log(uni.$mpShare);
    return uni.$mpShare
  },
  onShareTimeline() { //分享到朋友圈
    return uni.$mpShare
  },
  onUnload() { // 关闭页面时重置
    uni.$mpShare = {
      title: '爱愈膳汤铺',
      path: '/pages/index/index',
      imageUrl: 'https://file.aiyushantp.com/file/b22aa4e4625714e2747b15cfa174ea2351e59df4bacec69d338f9c87c7dae5ca.png' // 全局图片链接
    }
    wx.offCopyUrl()
  }
}