组合函数
import system from '@/constant/system'
type ShareConfigType = Page.CustomShareContent | Promise<Omit<Page.CustomShareContent, 'promise'>>
type GetShareConfigType = (arg: Page.ShareAppMessageOption) => ShareConfigType
function useShare(_shareConfig?: GetShareConfigType) {
onShareAppMessage((_e) => {
return {
title: system.title,
path: system.homePage,
}
})
return {}
}
export default useShare
index.vue 引入
import useShares from '@/hooks/useShare'
useShares()
l***@163.com (作者)
一般正常情况页面写了onShareAppMessage((_e) => {
return {
title: system.title,
path: system.homePage,
}
})
点右上角三个点 里面的分享按钮就可以点击
我用上面组合函数的方式 三个点里面的分享按钮就不可点击
上面就是两个页面主要逻辑完整代码
2024-07-11 10:53