Commit 2133a8a8 authored by mxm-web-develop's avatar mxm-web-develop

Merge branch 'main' of gitlab.33.cn:Website/web2022

parents be20a535 e1219160
......@@ -68,7 +68,7 @@ const HoverLink = () =>{
export default function Navbar (props: IAppProps) {
const {pathname} = useLocation()
const {data} = React.useContext(AppContext)
// console.log('nav',data)
return (
<nav className='flex min-w-[1440px] justify-between absolute px-[120px] w-full top-0 z-[99999] py-6 text-sm text-[#061E3B] font-normal '>
<div className='left '>
......
......@@ -76,16 +76,19 @@ const Dots = (props:DotsType)=>{
export const ScrollView = (props: ScrollViewType) => {
BScroll.use(MouseWheel);
BScroll.use(ScrollBar);
BScroll.use(Slide);
BScroll.use(NestedScroll)
const { children } = props;
BScroll.use(Slide);
// const location = useLocation()
const wrapRef = useRef<HTMLDivElement>(null);
const location = useLocation()
const {data,dispatch} = useContext(AppContext)
const { children } = props;
const [dots,setDots]= useState(0)
const [scrollObj, setScrollObj] = useState<BScrollConstructor<{}>>();
const [currentPage,setCurrentPage] = useState(0)
const {data,dispatch} = useContext(AppContext)
useEffect(()=>{
const scrollEl = initBScroll(wrapRef.current as HTMLDivElement)
setScrollObj(scrollEl)
......@@ -107,7 +110,10 @@ export const ScrollView = (props: ScrollViewType) => {
scrollObj&&scrollObj.on('slidePageChanged', (page:any) => {
setCurrentPage((prevState: number)=>{
if(prevState !== page.pageY){
setTimeout(()=>{
dispatch({type:'slideOnChange',payload:{pageIndex:page.pageY}})
},0)
return page.pageY
}
return prevState
......
......@@ -32,10 +32,10 @@ const AppReducer = (state:typeof data,action:Actions)=>{
state.currentPage = payload.currentPage
break;
}
console.log(state);
// console.log(state);
return state
return {...state}
}
export const AppProvider = (props: any)=>{
......
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