uniapp scroll-view 不生效排查

排查路径:

  1. 开启 refresher-enabled 属性
  2. 使用竖向滚动时,需要给 <scroll-view> 一个固定高度,通过 css 设置 height;使用横向滚动时,需要给 <scroll-view> 添加 white-space: nowrap; 样式
  3. 父元素不要设置 css 属性:overflow: hidden
  4. 一定要使用 snake-case 格式!即:<scroll-view></scroll-view>,不要使用驼峰格式:<ScrollView></ScrollView>,巨特么坑!
<template>
    <view class="viewport">
        <!-- 注意必须是 snake-case,否则会不生效 -->
        <scroll-view class="scroll-view"  refresher-enabled scrollY>
            <!-- 轮播图 -->
            <MySwiper class="my-swiper" :customStyle="{
                width: '100vw',
                height: '300rpx'
            }" :data="swiperInfos" />
            <!-- 分类面板 -->
            <CategoryPanel :data="categoryInfos" />
        </scroll-view>
    </view>

</template>

<style lang="scss" scoped>
.viewport {
    height: 100vh;
    display: flex;
    flex-direction: column;

    .scroll-view {
        flex: 1;
        overflow: hidden;
    }
}
</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值