实现横线滚动-不显示滚动条 直接用

 

   <view class="country_box">
        <view
          class="country_item"
          v-for="item in countryList"
          :key="item.code"
          @click="transportTypeClick(item)"
        >
          <image
            :src="item.imgUrl"
            mode="widthFix"
            class="transport_type_img"
          ></image>
          <text class="transport_type_text">{{ item.info }}</text>
        </view>
      </view>


      countryList: [
        {
          code: 1,
          info: 'AA',
          imgUrl:
            'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },
        {
          code: 2,
          info: 'BB',
          imgUrl:
            'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },
        {
          code: 6,
          info: 'CC',
          imgUrl:
            'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },
        {
          code: 3,
          info: 'DD',
          imgUrl:
            'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },
        {
          code: 4,
          info: 'EE',
          imgUrl:
            'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },

        {
          code: 7,
          info: 'FF',
          imgUrl:
            'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },
        {
          code: 8,
          info: 'GG',
          imgUrl:
            'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },
        {
          code: 9,
          info: 'HH',
          imgUrl:
            'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        }
      ],
    .country_box {
      display: flex; /* 子元素横向排列 */
      width: 697rpx;
      overflow-x: scroll; /* 横向滚动 */
      scrollbar-width: none; /* 隐藏滚动条 (适用于 Firefox) */
      -ms-overflow-style: none; /* 隐藏滚动条 (适用于 IE/Edge) */
      .country_item {
        width: 116.9rpx;
        display: flex;
        flex-direction: column;
        align-items: center;
        flex-shrink: 0;
        .transport_type_img {
          width: 76rpx;
          height: 76rpx;
          margin-bottom: 7rpx;
        }
        .transport_type_text {
          display: inline-block;
          // width: 100rpx;
          height: 36rpx;
          font-family: SourceHanSansCN, SourceHanSansCN;
          font-weight: 400;
          font-size: 25rpx;
          color: #282828;
          line-height: 36rpx;
          text-align: center;
          font-style: normal;
        }
      }
    }

    .country_box::-webkit-scrollbar {
      display: none; /* 隐藏滚动条 (适用于 Chrome/Safari) */
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值