feat(share): 补做首页分享功能,支持仅分享到好友

- useShare 增加 enableTimeline 配置,默认启用朋友圈分享
- 首页配置 enableShareAppMessage 并调用 useShare,enableTimeline 设为 false
- 解决 tabBar 页微信不支持朋友圈分享的问题,避免无效注册
- 分享路径添加裂变参数,增强邀请下级功能
- 保持类型检查零错误,改动兼容现有历史 TS2688 错误
This commit is contained in:
2026-07-13 08:22:13 +08:00
parent d6d6b1f5a7
commit e39eebbf1c
3 changed files with 19 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
import { View, Text, ScrollView, Swiper, SwiperItem, Image } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { useUser } from '@/hooks/useUser'
import { useShare } from '@/hooks/useShare'
import { useScrollHeight } from '@/hooks/useScrollHeight'
import { listCmsAd } from '@/api/cms/cmsAd'
import { listCmsArticle } from '@/api/cms/cmsArticle'
@@ -14,6 +15,7 @@ import { getCompressedImageUrl } from '@/utils/image'
definePageConfig({
navigationBarTitleText: '首页',
enableShareAppMessage: true,
})
const IndexPage: React.FC = () => {
@@ -24,6 +26,13 @@ const IndexPage: React.FC = () => {
const [loading, setLoading] = useState(true)
const scrollHeight = useScrollHeight(44)
// 首页分享给好友tabBar 页不支持朋友圈,仅启用好友分享)
useShare({
title: '鑫龙家电 - 精选好物,实惠到家,等你来逛~',
path: '/pages/index/index',
enableTimeline: false,
})
const categories = ['全部', '球拍', '球鞋', '服装', '配件']