当前位置: 首页 > wzjs >正文

一个网站多大空间哈尔滨优化网站公司

一个网站多大空间,哈尔滨优化网站公司,做汽车团购的网站建设,做自适应网站注意事项在小程序的开发中,不可避免会出现上下左右拖动表格的类似需求,下面将把这个简单实现一下 其中主要使用到了overflow: scroll;来使得横向和纵向可以滚动,并且使用负边距 父容器截断的方法来同时隐藏横向和纵向滚动条,从而实现该效…

在小程序的开发中,不可避免会出现上下左右拖动表格的类似需求,下面将把这个简单实现一下
在这里插入图片描述
其中主要使用到了overflow: scroll;来使得横向和纵向可以滚动,并且使用负边距 + 父容器截断的方法来同时隐藏横向和纵向滚动条,从而实现该效果。

负边距 + 父容器截断主要思路:

  1. 父容器:设置 overflow: hidden 截断滚动条。
  2. 子容器:
    通过通过 calc(100% + 滚动条宽度) 扩大尺寸,补偿滚动条占用的空间。
    设置 overflow: scroll 允许内容滚动。
    padding-rightpadding-bottom 补偿滚动条宽度,避免内容被遮挡。

在移动时上方的标题也会跟随滚动条一起移动,那么就需要设置 position: sticky;,配合top:0;或者left:0;等定位阈值,来设置是固定在哪里不进行移动。
position: sticky;是css中的一个定位属性,用于实现“粘性定位”的效果。作用类似于position:relative;position:fixed;的结合体:元素在滚动到特定阈值前表现为相对定位(relative),到达阈值后表现为固定定位(fixed),从而始终可见。元素会停留在父容器或视口的指定位置(如顶部),直到父容器滚动结束。
该属性依赖于两个条件:

  1. 必须指定至少一个定位阈值(如top:10px;bottom:0;等)
  2. 父容器不能有overflow:hidden;(否则失效)
<template lang=""><view class="box"><view class="placeBox"><!-- 左侧时间label --><view class="timeLabel"><view class="timeBox"><viewclass="timeStr"v-for="(t, index) in timeLabel":key="index">{{ t }}</view></view></view><!-- 右侧内容区域 --><view class="contentBox"><!-- top 场地label --><view class="placeLabel"><viewclass="placeStr"v-for="(i, index) in fieldList":key="index"@click="selectField(i)">{{ i.stationname }}</view></view><!-- content 内容区域 --><view class="content"><viewclass="colum"v-for="(p, index) in fieldList":key="index"><view v-for="cell in p.weekarr" :key="cell.hour"><view class="cell">{{ cell.hour }}</view></view></view></view></view></view></view>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const fieldList = ref([{stationname: '周一',weekarr: [{hour: '10:00',status: 0,explain: 0,},{hour: '11:00',status: 0,explain: 0,},],},{stationname: '周二',weekarr: [{hour: '10:00',status: 0,explain: 0,},{hour: '11:00',status: 0,explain: 0,},],},{stationname: '周三',weekarr: [{hour: '10:00',status: 0,explain: 0,},{hour: '11:00',status: 0,explain: 0,},],},{stationname: '周四',weekarr: [{hour: '10:00',status: 0,explain: 0,},{hour: '11:00',status: 0,explain: 0,},],},{stationname: '周五',weekarr: [{hour: '10:00',status: 0,explain: 0,},{hour: '11:00',status: 0,explain: 0,},],},{stationname: '周六',weekarr: [{hour: '10:00',status: 0,explain: 0,},{hour: '11:00',status: 0,explain: 0,},],},{stationname: '周日',weekarr: [{hour: '10:00',status: 0,explain: 0,},{hour: '11:00',status: 0,explain: 0,},],},
])const timeLabel = ref(['1号', '2号', '3号', '4号', '5号', '6号', '7号'])
</script>
<style lang="scss" scoped>
.box {width: 600rpx;height: 300rpx;overflow: hidden;.placeBox {display: flex;flex-direction: row;width: calc(100% + 20px);height: calc(100% + 20px);border: 2rpx solid #4423ff;overflow: scroll;background: #fff;padding-right: 20px; /* 避免内容被滚动条遮挡 */box-sizing: border-box; /* 确保padding不影响总尺寸 */.timeLabel {padding-top: 52rpx;position: sticky;left: 0;background: #fff;.timeBox {display: flex;flex-direction: column;border: 1rpx solid #f83b3b;padding-bottom: 20px;}.timeStr {width: 100rpx;height: 50rpx;text-align: center;line-height: 50rpx;}}.contentBox {.placeLabel {display: flex;flex-direction: row;position: sticky;top: 0;border: 1rpx solid #6dceff;.placeStr {width: 100rpx;height: 50rpx;border: 1rpx solid #000;text-align: center;line-height: 50rpx;background: #fff;}}.content {display: flex;flex-direction: row;align-items: center;justify-content: center;background: #ccc;.colum {.cell {width: 100rpx;height: 50rpx;border: 1rpx solid #000;}}}}}
}
</style>
http://www.dtcms.com/wzjs/513535.html

相关文章:

  • 深圳专业网站建设平台网页seo外链
  • 手机网站后台源码百度一下你就知道首页
  • 电子商务网站建设方案的总结网站推广教程
  • 广州的网站建设公司哪家好网站建设外包
  • 深圳市网站建设做网站深圳网站建设运营
  • 中信建设有限责任公司电子商务平台深圳百度seo代理
  • ipv6网站建设东莞磁力屋torrentkitty
  • 哪个网站可以做360度评估文案写作软件app
  • 动态网站开发上机操作试卷邵阳网站seo
  • 应用java网站建设前景近几年的网络营销案例
  • 河南疫情最新消息今天新增廊坊关键词优化排名
  • 系统搭建平台武汉seo学徒
  • 上海市建设党工委网站百度开户推广
  • 网站访问量过大搜狗站长平台验证不了
  • 上海推广网络营销咨询热线seo营销培训咨询
  • 台州那家网站做的好长沙seo优化排名推广
  • wordpress导购页面郑州seo顾问阿亮
  • 链接网站logo郑州模板网站建设
  • 做正品的网站搜索引擎推广案例
  • php做网站架构图seo排名优化推荐
  • 编程线上课程哪个机构好一些东莞seo关键词排名优化排名
  • 武汉网站建设电话怎么注册自己公司的网址
  • 企业网站开发教学视频推广普通话手抄报图片大全
  • 临海做网站的公司seo待遇
  • 网站设计psd模板安徽seo优化规则
  • 做爰视频在线观看免费网站seo关键词排名优化怎样收费
  • 营销型网站建设和规划全国疫情排名一览表
  • 移动互联网开发就业前景网络seo推广培训
  • 如何选择合适的建站公司网页代码模板
  • 网站关键词怎么添加免费使用seo软件