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
b8f04181
Commit
b8f04181
authored
Aug 03, 2022
by
mxm-web-develop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
321
parent
40ea0dbf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
ScrollView.tsx
src/components/ScrollView.tsx
+7
-2
No files found.
src/components/ScrollView.tsx
View file @
b8f04181
...
@@ -11,6 +11,7 @@ import ContactImg from '@/assets/img/contact.png'
...
@@ -11,6 +11,7 @@ import ContactImg from '@/assets/img/contact.png'
import
{
useCallback
,
useContext
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
"react"
;
import
{
useCallback
,
useContext
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
"react"
;
import
{
LazyImg
}
from
"./LazyImg"
;
import
{
LazyImg
}
from
"./LazyImg"
;
import
{
useLocation
}
from
"react-router-dom"
;
interface
ScrollViewType
extends
IProps
{
interface
ScrollViewType
extends
IProps
{
wrapHeight
?:
string
;
wrapHeight
?:
string
;
prop
?:
any
;
prop
?:
any
;
...
@@ -79,13 +80,13 @@ export const ScrollView = (props: ScrollViewType) => {
...
@@ -79,13 +80,13 @@ export const ScrollView = (props: ScrollViewType) => {
BScroll
.
use
(
NestedScroll
)
BScroll
.
use
(
NestedScroll
)
const
{
wrapHeight
,
children
}
=
props
;
const
{
wrapHeight
,
children
}
=
props
;
const
wrapRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
wrapRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
location
=
useLocation
()
const
[
dots
,
setDots
]
=
useState
(
0
)
const
[
dots
,
setDots
]
=
useState
(
0
)
const
[
scrollObj
,
setScrollObj
]
=
useState
<
BScrollConstructor
<
{}
>>
();
const
[
scrollObj
,
setScrollObj
]
=
useState
<
BScrollConstructor
<
{}
>>
();
const
[
currentPage
,
setCurrentPage
]
=
useState
(
0
)
const
[
currentPage
,
setCurrentPage
]
=
useState
(
0
)
const
{
data
,
dispatch
}
=
useContext
(
AppContext
)
const
{
data
,
dispatch
}
=
useContext
(
AppContext
)
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
data
);
dispatch
({
type
:
'doSome'
})
dispatch
({
type
:
'doSome'
})
},[])
},[])
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -108,6 +109,10 @@ export const ScrollView = (props: ScrollViewType) => {
...
@@ -108,6 +109,10 @@ export const ScrollView = (props: ScrollViewType) => {
return
prevState
return
prevState
})
})
scrollObj
?.
on
(
'slidePageChanged'
,
(
page
:
any
)
=>
{
scrollObj
?.
on
(
'slidePageChanged'
,
(
page
:
any
)
=>
{
const
data
=
{
page
:
page
.
pageY
,
}
setCurrentPage
((
prevState
:
number
)
=>
{
setCurrentPage
((
prevState
:
number
)
=>
{
if
(
prevState
!==
page
.
pageY
){
if
(
prevState
!==
page
.
pageY
){
return
page
.
pageY
return
page
.
pageY
...
...
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