forked from gxwebsoft/mp-10550
feat(index): 实现Header组件吸顶效果和轮播图触摸优化
- 添加Sticky组件实现Header吸顶功能 - 优化轮播图触摸事件,防止与页面滚动冲突 - 调整轮播图容器样式,确保手势操作流畅 - 更新Header组件结构以支持粘性布局 - 修复Banner组件中图片列表的key属性问题 - 移除不必要的状态传递和冗余代码
This commit is contained in:
@@ -98,7 +98,7 @@ const MyPage = () => {
|
||||
return (
|
||||
<View className="flex p-2 justify-between" style={{height: `${carouselHeight}px`}}>
|
||||
{/* 左侧轮播图区域 */}
|
||||
<View style={{width: '50%', height: '100%'}}>
|
||||
<View style={{width: '50%', height: '100%'}} className="banner-swiper-container">
|
||||
<Swiper
|
||||
defaultValue={0}
|
||||
height={carouselHeight}
|
||||
@@ -106,9 +106,10 @@ const MyPage = () => {
|
||||
autoPlay
|
||||
duration={3000}
|
||||
style={{
|
||||
height: `${carouselHeight}px`,
|
||||
touchAction: 'pan-y'
|
||||
height: `${carouselHeight}px`
|
||||
}}
|
||||
disableTouch={false}
|
||||
touchAngle={"45"} // 关键修改:设置触摸角度阈值
|
||||
>
|
||||
{carouselData && carouselData?.imageList?.map((img, index) => (
|
||||
<Swiper.Item key={index}>
|
||||
@@ -139,7 +140,7 @@ const MyPage = () => {
|
||||
}}>
|
||||
{
|
||||
hotToday?.imageList?.map(item => (
|
||||
<View className={'item flex flex-col mr-1'}>
|
||||
<View className={'item flex flex-col mr-1'} key={item.url}>
|
||||
<Image
|
||||
width={70}
|
||||
height={70}
|
||||
@@ -180,5 +181,4 @@ const MyPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export default MyPage
|
||||
|
||||
export default MyPage
|
||||
Reference in New Issue
Block a user