|
|
@@ -38,8 +38,6 @@ function Policy({ setShowTab }: { setShowTab: (tab: number) => void }) {
|
|
|
|
|
|
// 处理滚轮事件
|
|
|
const handleWheel = (e: any) => {
|
|
|
- console.log('xxxxxx', originRef.current)
|
|
|
-
|
|
|
if (originRef.current) {
|
|
|
originRef.current.scrollLeft += e.deltaY
|
|
|
}
|
|
|
@@ -61,20 +59,42 @@ function Policy({ setShowTab }: { setShowTab: (tab: number) => void }) {
|
|
|
const part1TXT = document.querySelectorAll('#part1TXT')
|
|
|
part1TXT.forEach((v: any) => {
|
|
|
v.addEventListener('wheel', (e: any) => {
|
|
|
- e.preventDefault()
|
|
|
- e.stopPropagation()
|
|
|
- console.log('part1TXT', v.scrollTop += e.deltaY)
|
|
|
-
|
|
|
+ // const aa =document.querySelector('.xxx') as HTMLDivElement
|
|
|
+
|
|
|
+ if (e.deltaY > 0) {
|
|
|
+ // 向下滚
|
|
|
+ if (v.scrollHeight - (v.scrollTop || 0) === v.clientHeight) {
|
|
|
+ // console.log('滚到底了')
|
|
|
+ } else {
|
|
|
+ e.preventDefault()
|
|
|
+ e.stopPropagation()
|
|
|
+ v.scrollTop += e.deltaY / 2
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 向上滚
|
|
|
+ if (v.scrollTop === 0) {
|
|
|
+ // console.log('滚到顶了')
|
|
|
+ } else {
|
|
|
+ e.preventDefault()
|
|
|
+ e.stopPropagation()
|
|
|
+ v.scrollTop += e.deltaY / 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // console.log(v.scrollHeight, v.scrollTop, v.clientHeight)
|
|
|
+
|
|
|
+ // e.preventDefault()
|
|
|
+ // e.stopPropagation()
|
|
|
+ // console.log('part1TXT', (v.scrollTop += e.deltaY))
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
}, [currentItem])
|
|
|
|
|
|
return (
|
|
|
<div className={styles.Policy}>
|
|
|
<Zback clickFu={() => setShowTab(0)} />
|
|
|
|
|
|
- <div className='containner' >
|
|
|
+ <div className='containner'>
|
|
|
<div className='containner2' ref={originRef} onWheel={handleWheel}>
|
|
|
{myData.policy.map((item, index) => (
|
|
|
<div className='tabItem' ref={itemRef} key={item.title}>
|
|
|
@@ -148,8 +168,9 @@ function Policy({ setShowTab }: { setShowTab: (tab: number) => void }) {
|
|
|
{item.title}
|
|
|
</div>
|
|
|
<img
|
|
|
- src={require(`@/assets/img/A7base3_icon${currentItem - 1 === index ? 'A' : '_n'
|
|
|
- }.png`)}
|
|
|
+ src={require(`@/assets/img/A7base3_icon${
|
|
|
+ currentItem - 1 === index ? 'A' : '_n'
|
|
|
+ }.png`)}
|
|
|
alt=''
|
|
|
/>
|
|
|
</div>
|