feat(shop): 接入分类页分享功能支持好友、朋友圈及复制链接

- 在 `src/pages/shop/index.config.ts` 中启用分享转发配置
- 在 `src/pages/shop/index.tsx` 增加 `useShare` 钩子调用,支持分享标题、路径及朋友圈和复制链接功能
- 分类页作为 tabBar 页面,确保三种分享按钮均可用
- 通过类型检查,代码无错误保证功能稳定
This commit is contained in:
2026-07-13 12:15:03 +08:00
parent 8a9cf43fd9
commit 2f12a1fd27
3 changed files with 17 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
export default {
navigationBarTitleText: '购物商城',
enableShareAppMessage: true,
enableShareTimeline: true,
}

View File

@@ -10,6 +10,7 @@ import { isGuest } from '@/utils/auth'
import { isVipMember } from '@/utils/vip'
import { getCompressedImageUrl } from '@/utils/image'
import { requireLogin } from '@/utils/login-guard'
import { useShare } from '@/hooks/useShare'
import EmptyState from '@/components/common/EmptyState'
import LoadMore from '@/components/common/LoadMore'
@@ -52,6 +53,14 @@ const ShopPage: React.FC = () => {
const [keyword, setKeyword] = useState('')
const searchTimerRef = useRef<any>(null)
// 分享tabBar 页支持好友分享 + 朋友圈 + 复制链接)
useShare({
title: '购物商城 - 精选好物,实惠到家,等你来逛~',
path: '/pages/shop/index',
enableTimeline: true,
enableCopyUrl: true,
})
useEffect(() => {
loadCategories()
}, [])