import React, { useCallback, useEffect, useRef } from 'react' import styles from './index.module.scss' import classNames from 'classnames' import { domDelOwnFu } from '@/utils/utilsSome' import BtnRight from '../BtnRight' type Props = { isShow: boolean src: string parentFu: () => void noBtn?: boolean //没有跳过按钮 } function CatVideo({ isShow, src, parentFu, noBtn }: Props) { const videoRef = useRef(null) useEffect(() => { if (isShow) { setTimeout(() => { if (videoRef.current) videoRef.current.play() }, 100) } }, [isShow]) const playEndFu = useCallback(() => { parentFu() // 0.5s之后删除过度视频 setTimeout(() => { domDelOwnFu('#CatVideo') }, 500) }, [parentFu]) return (
{/* 右下角的跳过按钮 */} {noBtn ? null : playEndFu()} title='跳过' />}
) } const MemoCatVideo = React.memo(CatVideo) export default MemoCatVideo