diff --git a/.workbuddy/memory/2026-07-13.md b/.workbuddy/memory/2026-07-13.md index dc8faca..34459e6 100644 --- a/.workbuddy/memory/2026-07-13.md +++ b/.workbuddy/memory/2026-07-13.md @@ -16,3 +16,9 @@ - 复制链接:基础库 2.14.3+ Beta(官方说仅 Android,实测 iOS 也支持);朋友圈/复制链接开发者工具可能看不到入口,需真机测试。 - 注意:首页分享朋友圈后是单页模式(无登录态/不能跳转/tabBar 不渲染),首页是交互型页面,单页体验受限,但作传播入口可用;如需更好体验可用 `isTimelineSinglePage()` 做降级。 - 类型检查:零错误(历史既有 1 个 TS2688 仍在)。 + +## 分类页(pages/shop/index)分享接入 +- `src/pages/shop/index.config.ts`:加 `enableShareAppMessage: true` + `enableShareTimeline: true` +- `src/pages/shop/index.tsx`:导入 `useShare`,组件内调用 `useShare({ title:'购物商城 - 精选好物...', path:'/pages/shop/index', enableTimeline:true, enableCopyUrl:true })` +- 分类页和首页一样是 tabBar 页,三按钮全亮(好友/朋友圈/复制链接) +- 类型检查:零错误 diff --git a/src/pages/shop/index.config.ts b/src/pages/shop/index.config.ts index bb60ab4..2928f1a 100644 --- a/src/pages/shop/index.config.ts +++ b/src/pages/shop/index.config.ts @@ -1,3 +1,5 @@ export default { navigationBarTitleText: '购物商城', + enableShareAppMessage: true, + enableShareTimeline: true, } diff --git a/src/pages/shop/index.tsx b/src/pages/shop/index.tsx index 33c7e30..1066814 100644 --- a/src/pages/shop/index.tsx +++ b/src/pages/shop/index.tsx @@ -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(null) + // 分享(tabBar 页支持好友分享 + 朋友圈 + 复制链接) + useShare({ + title: '购物商城 - 精选好物,实惠到家,等你来逛~', + path: '/pages/shop/index', + enableTimeline: true, + enableCopyUrl: true, + }) + useEffect(() => { loadCategories() }, [])