Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web2022
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Website
web2022
Commits
6380fe57
Commit
6380fe57
authored
Aug 03, 2022
by
salitedfish
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 关于我们添加上下页按钮
parent
c8f258dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
25 deletions
+53
-25
step.png
src/assets/img/step.png
+0
-0
EventsScrollView.tsx
src/components/EventsScrollView.tsx
+4
-0
index.tsx
src/views/About/Memorabilia/index.tsx
+49
-25
No files found.
src/assets/img/step.png
0 → 100644
View file @
6380fe57
951 Bytes
src/components/EventsScrollView.tsx
View file @
6380fe57
...
@@ -10,6 +10,7 @@ import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "r
...
@@ -10,6 +10,7 @@ import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "r
interface
ScrollViewType
extends
IProps
{
interface
ScrollViewType
extends
IProps
{
wrapHeight
?:
string
;
wrapHeight
?:
string
;
prop
?:
any
;
prop
?:
any
;
getScrollHandler
?:
(
next
:
Function
,
prev
:
Function
)
=>
void
}
}
const
initBScroll
=
(
el
:
HTMLElement
)
=>
{
const
initBScroll
=
(
el
:
HTMLElement
)
=>
{
...
@@ -57,6 +58,9 @@ export const EventsScrollView = (props: ScrollViewType) => {
...
@@ -57,6 +58,9 @@ export const EventsScrollView = (props: ScrollViewType) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
const
scrollEl
=
initBScroll
(
wrapRef
.
current
as
HTMLDivElement
)
const
scrollEl
=
initBScroll
(
wrapRef
.
current
as
HTMLDivElement
)
setScrollObj
(
scrollEl
)
setScrollObj
(
scrollEl
)
if
(
props
.
getScrollHandler
)
{
props
.
getScrollHandler
(
scrollEl
.
next
,
scrollEl
.
prev
)
}
return
()
=>
{
return
()
=>
{
scrollObj
?.
destroy
();
scrollObj
?.
destroy
();
};
};
...
...
src/views/About/Memorabilia/index.tsx
View file @
6380fe57
import
{
IProps
}
from
"@/common/Iprops.interface"
import
{
IProps
}
from
"@/common/Iprops.interface"
import
{
AppContianer
}
from
"@/layouts/AppContianer"
import
{
AppContianer
}
from
"@/layouts/AppContianer"
import
{
useRef
,
useState
,
useEffect
,
useMemo
,
useCallback
}
from
'react'
import
{
useRef
,
useState
,
useEffect
,
useMemo
,
useCallback
,
Fragment
}
from
'react'
import
{
getEvents
}
from
"@/fetch/dataFetch"
import
{
getEvents
}
from
"@/fetch/dataFetch"
import
{
EventItem
,
EventsTable
}
from
"./EventItem"
import
{
EventItem
,
EventsTable
}
from
"./EventItem"
import
{
EventsScrollView
}
from
"@/components/EventsScrollView"
import
{
EventsScrollView
}
from
"@/components/EventsScrollView"
import
Step
from
"@/assets/img/step.png"
interface
MemorabiliaType
extends
IProps
{
interface
MemorabiliaType
extends
IProps
{
...
@@ -22,37 +24,59 @@ export const Memorabilia = () => {
...
@@ -22,37 +24,59 @@ export const Memorabilia = () => {
return
()
=>
fetchData
.
unsubscribe
()
return
()
=>
fetchData
.
unsubscribe
()
},[
currentSlide
])
},[
currentSlide
])
const
scrollHandler
:
{
next
?:
Function
prev
?:
Function
}
=
{}
const
getScrollHandler
=
(
next
:
Function
,
prev
:
Function
)
=>
{
scrollHandler
.
next
=
next
scrollHandler
.
prev
=
prev
}
const
scrollTo
=
(
step
:
number
)
=>
{
switch
(
step
)
{
case
1
:
scrollHandler
.
next
?
scrollHandler
.
next
()
:
null
;
break
case
-
1
:
scrollHandler
.
prev
?
scrollHandler
.
prev
()
:
null
;
break
}
}
return
(
return
(
<
AppContianer
className=
"flex items-center justify-start h-full w-full relative labtop:px-[120px] "
>
<
AppContianer
className=
"flex items-center justify-start h-full w-full relative labtop:px-[120px] "
>
<
div
className=
'w-[896px]'
>
<
div
className=
'w-[896px]'
>
<
div
className=
'absolute top-12 labtop:right-[14rem] right-[7rem]'
>
<
div
className=
'absolute top-12 labtop:right-[14rem] right-[7rem]'
>
<
div
className=
"hero-title"
>
Memorabilia
</
div
>
<
div
className=
"hero-title"
>
Memorabilia
</
div
>
<
div
className=
"subTitle-1-cn py-3 flex items-center gap-x-5"
>
<
div
className=
"subTitle-1-cn py-3 flex items-center gap-x-5"
>
<
div
className=
" w-28 h-1 bg-theme-dark rounded"
></
div
>
<
div
className=
" w-28 h-1 bg-theme-dark rounded"
></
div
>
<
div
>
功能特点
</
div
>
<
div
>
功能特点
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
{
{
data
?
data
?
<
div
className=
"relative"
>
<
EventsScrollView
>
<
img
className=
'absolute top-96 -left-16 rotate-180 opacity-30 hover:opacity-100 cursor-pointer'
onClick=
{
()
=>
scrollTo
(
-
1
)
}
src=
{
Step
}
alt=
""
/>
<
div
className=
'flex '
>
<
EventsScrollView
getScrollHandler=
{
getScrollHandler
}
>
{
<
div
className=
'flex '
>
data
.
length
>
0
&&
data
.
map
((
g
:
any
,
index
:
number
)
=>
(
{
<
div
className=
'w-full h-[800px] translate-y-[60px] '
key=
{
index
}
>
data
.
length
>
0
&&
data
.
map
((
g
:
any
,
index
:
number
)
=>
(
<
EventsTable
tableIndex=
{
currentSlide
}
data=
{
g
}
></
EventsTable
>
<
div
className=
'w-full h-[800px] translate-y-[60px] '
key=
{
index
}
>
</
div
>
<
EventsTable
tableIndex=
{
currentSlide
}
data=
{
g
}
></
EventsTable
>
))
</
div
>
}
))
</
div
>
}
</
EventsScrollView
>
:
<
div
>
loading
</
div
>
</
div
>
}
</
EventsScrollView
>
<
img
className=
'absolute top-96 -right-16 opacity-30 hover:opacity-100 cursor-pointer'
onClick=
{
()
=>
scrollTo
(
1
)
}
src=
{
Step
}
alt=
""
/>
</
div
>
:
<
div
>
loading
</
div
>
}
</
div
>
</
div
>
</
AppContianer
>
</
AppContianer
>
...
...
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