|
|
@ -14,6 +14,10 @@ const MyPage = () => { |
|
|
|
const [hotToday, setHotToday] = useState<CmsAd>() |
|
|
|
const [item, setItem] = useState<CmsArticle>() |
|
|
|
const [loading, setLoading] = useState(true) |
|
|
|
// const [disableSwiper, setDisableSwiper] = useState(false)
|
|
|
|
|
|
|
|
// 用于记录触摸开始位置
|
|
|
|
// const touchStartRef = useRef({x: 0, y: 0})
|
|
|
|
|
|
|
|
// 加载数据
|
|
|
|
const loadData = async () => { |
|
|
@ -98,7 +102,10 @@ const MyPage = () => { |
|
|
|
return ( |
|
|
|
<View className="flex p-2 justify-between" style={{height: `${carouselHeight}px`}}> |
|
|
|
{/* 左侧轮播图区域 */} |
|
|
|
<View style={{width: '50%', height: '100%'}} className="banner-swiper-container"> |
|
|
|
<View |
|
|
|
style={{width: '50%', height: '100%'}} |
|
|
|
className="banner-swiper-container" |
|
|
|
> |
|
|
|
<Swiper |
|
|
|
defaultValue={0} |
|
|
|
height={carouselHeight} |
|
|
@ -106,13 +113,15 @@ const MyPage = () => { |
|
|
|
autoPlay |
|
|
|
duration={3000} |
|
|
|
style={{ |
|
|
|
height: `${carouselHeight}px` |
|
|
|
height: `${carouselHeight}px`, |
|
|
|
touchAction: 'pan-y' // 关键修改:允许垂直滑动
|
|
|
|
}} |
|
|
|
disableTouch={false} |
|
|
|
touchAngle={"45"} // 关键修改:设置触摸角度阈值
|
|
|
|
direction="horizontal" |
|
|
|
className="custom-swiper" |
|
|
|
> |
|
|
|
{carouselData && carouselData?.imageList?.map((img, index) => ( |
|
|
|
<Swiper.Item key={index}> |
|
|
|
<Swiper.Item key={index} style={{ touchAction: 'pan-x pan-y' }}> |
|
|
|
<Image |
|
|
|
width="100%" |
|
|
|
height="100%" |
|
|
@ -122,7 +131,8 @@ const MyPage = () => { |
|
|
|
lazyLoad={false} |
|
|
|
style={{ |
|
|
|
height: `${carouselHeight}px`, |
|
|
|
borderRadius: '4px' |
|
|
|
borderRadius: '4px', |
|
|
|
touchAction: 'manipulation' // 关键修改:优化触摸操作
|
|
|
|
}} |
|
|
|
/> |
|
|
|
</Swiper.Item> |
|
|
@ -181,4 +191,4 @@ const MyPage = () => { |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
export default MyPage |
|
|
|
export default MyPage |
|
|
|