import { onShareAppMessage } from '@dcloudio/uni-app'

export default {
  onLoad() {
    // #ifdef MP-WEIXIN
    wx.showShareMenu({
      withShareTicket: false,
      menus: ['shareAppMessage', 'shareTimeline']
    })
    // #endif
  },
  onShareAppMessage() {
    const customSharePaths = ['pages/goodsDetail/goodsDetail'] // 不走全局分享配置的路径
    // 获取当前页面栈
    const pages = getCurrentPages()
    // 获取当前路由路径
    const currentPath = pages[pages.length - 1]?.route
    console.log('currentPath----------', currentPath)
    return {}
    // if (!customSharePaths.includes(currentPath)) {
    //   return {
    //     title: '江楠甄选',
    //     path: '/pages/home/home',
    //     imageUrl:
    //       'https://cfzy-durian-front.tos-cn-guangzhou.volces.com/zm-mall-mini-app/wx_share_logo.png'
    //   }
    // } else {
    //   return {}
    // }
  }
}
