Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekLearnMathWeapp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frontend
GeekLearnMathWeapp
Commits
37d4ffa2
Commit
37d4ffa2
authored
Mar 27, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: type
parent
eba4c7b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
round-tag.tsx
src/pages/main/components/scene/round-tag.tsx
+6
-3
short-cut.tsx
src/pages/main/components/short-cut.tsx
+5
-2
No files found.
src/pages/main/components/scene/round-tag.tsx
View file @
37d4ffa2
import
{
Image
}
from
'@tarojs/components'
import
{
Image
}
from
'@tarojs/components'
import
{
useEffect
,
useRef
,
useMemo
}
from
'react'
import
{
useEffect
,
useRef
,
useMemo
}
from
'react'
import
{
usePageScroll
,
createIntersectionObserver
,
getCurrentInstance
,
getMenuButtonBoundingClientRect
}
from
'@tarojs/taro'
import
{
usePageScroll
,
createIntersectionObserver
,
getCurrentInstance
,
getMenuButtonBoundingClientRect
,
IntersectionObserver
}
from
'@tarojs/taro'
type
RoundTagProps
=
{
type
RoundTagProps
=
{
url
:
string
;
url
:
string
;
...
@@ -22,11 +22,14 @@ const RoundTag = (props: RoundTagProps) => {
...
@@ -22,11 +22,14 @@ const RoundTag = (props: RoundTagProps) => {
const
uid
=
useMemo
(()
=>
`tag_
${
id
}
`
,
[
id
])
const
uid
=
useMemo
(()
=>
`tag_
${
id
}
`
,
[
id
])
useEffect
(()
=>
{
useEffect
(()
=>
{
let
observer
let
observer
:
IntersectionObserver
|
null
=
null
if
(
ready
)
{
if
(
ready
)
{
lastEffectedScroll
.
current
=
scrollRef
.
current
lastEffectedScroll
.
current
=
scrollRef
.
current
const
navVal
=
nav
.
current
const
navVal
=
nav
.
current
observer
=
(
createIntersectionObserver
as
any
)().
relativeToViewport
({
bottom
:
0
,
top
:
-
navVal
.
height
-
navVal
.
top
-
5
})
// @ts-ignore
observer
=
createIntersectionObserver
()
observer
.
relativeToViewport
({
bottom
:
0
,
top
:
-
navVal
.
height
-
navVal
.
top
-
5
})
.
observe
(
`#
${
uid
}
`
,
({
intersectionRatio
})
=>
{
.
observe
(
`#
${
uid
}
`
,
({
intersectionRatio
})
=>
{
const
show
=
intersectionRatio
>
0
const
show
=
intersectionRatio
>
0
...
...
src/pages/main/components/short-cut.tsx
View file @
37d4ffa2
...
@@ -23,7 +23,10 @@ const ShortCut = (props: ShortCutProps) => {
...
@@ -23,7 +23,10 @@ const ShortCut = (props: ShortCutProps) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
lastEffectedScroll
.
current
=
scrollRef
.
current
lastEffectedScroll
.
current
=
scrollRef
.
current
let
observer
=
(
createIntersectionObserver
as
any
)().
relativeToViewport
({
bottom
:
0
})
// @ts-ignore
let
observer
=
createIntersectionObserver
()
observer
.
relativeToViewport
({
bottom
:
0
})
.
observe
(
`#
${
CurrentRoundId
}
`
,
({
intersectionRatio
})
=>
{
.
observe
(
`#
${
CurrentRoundId
}
`
,
({
intersectionRatio
})
=>
{
const
show
=
intersectionRatio
>
0
const
show
=
intersectionRatio
>
0
setIsShow
(
show
)
setIsShow
(
show
)
...
@@ -36,7 +39,7 @@ const ShortCut = (props: ShortCutProps) => {
...
@@ -36,7 +39,7 @@ const ShortCut = (props: ShortCutProps) => {
return
()
=>
{
return
()
=>
{
if
(
observer
)
{
if
(
observer
)
{
observer
.
disconnect
()
observer
.
disconnect
()
observer
=
null
observer
=
null
!
}
}
}
}
},
[])
},
[])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment