123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import React, { useRef } from 'react'
- import Taro, { useShareAppMessage } from '@tarojs/taro'
- import shareTracking from '@/utils/tracking/share'
-
- export default function useShare(shareContent, trackData) {
- const shareRef = useRef()
- const trackRef = useRef()
-
- shareRef.current = shareContent
- trackRef.current = trackData
-
- useShareAppMessage((res) => {
- const {
- title,
- path,
- image,
- } = shareRef.current || {}
-
- const {
- event = 'share',
- eventType,
- propertyName,
- consultantId,
- sharePersonId,
- targetId,
- buildingId,
- } = trackRef.current || {}
-
- // 分享埋点
- shareTracking({
- event,
- eventType,
- propertyName,
- consultantId,
- sharePersonId,
- targetId,
- buildingId,
- })
-
- return { title, path, imageUrl: image }
- })
- }
|