Commit 37e157cf authored by hewenhao's avatar hewenhao

feat: update

parent 4791f652
import { Image } from '@tarojs/components'
import { useEffect, useState, useRef, useMemo } from 'react'
import { useEffect, useRef, useMemo } from 'react'
import { usePageScroll, createIntersectionObserver, getCurrentInstance, getMenuButtonBoundingClientRect } from '@tarojs/taro'
type RoundTagProps = {
......@@ -11,7 +11,6 @@ type RoundTagProps = {
const RoundTag = (props: RoundTagProps) => {
const nav = useRef(getMenuButtonBoundingClientRect())
const page = useMemo(() => getCurrentInstance().page, [])
const { url, className, id, ready } = props
const scrollRef = useRef(0)
const lastEffectedScroll = useRef(0)
......@@ -32,6 +31,7 @@ const RoundTag = (props: RoundTagProps) => {
const show = intersectionRatio > 0
const isDown = lastEffectedScroll.current < scrollRef.current
const page = getCurrentInstance().page
if (show && !isDown) {
page?.animate?.(`#${uid}`, [
......@@ -54,7 +54,7 @@ const RoundTag = (props: RoundTagProps) => {
observer = null
}
}
}, [uid, ready, page])
}, [uid, ready])
return (
<Image src={url} className={className} id={uid}></Image>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment