feat(shop): 接入分类页分享功能支持好友、朋友圈及复制链接
- 在 `src/pages/shop/index.config.ts` 中启用分享转发配置 - 在 `src/pages/shop/index.tsx` 增加 `useShare` 钩子调用,支持分享标题、路径及朋友圈和复制链接功能 - 分类页作为 tabBar 页面,确保三种分享按钮均可用 - 通过类型检查,代码无错误保证功能稳定
This commit is contained in:
@@ -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()
|
||||
}, [])
|
||||
|
||||
Reference in New Issue
Block a user