vue 底部页面滑动,里面div不能滑动的解决

为了项目需求,让背景图片不滑动,内容部分滑动。所以html,body设为width:100%;height:100%;根节点设置为width:100%;height:745px;background:url("../...png") no-repeat;

由于body为一屏大小,所以不可滑动,此时要给根节点加个滑动组件包裹所有的可滑动部分。但由于使用滑动组件,导致原来里面一个能左右滑动的div不能滑动了,应该是冲突了。此时应该使用flex

html部分

<div class="historyList" v-if="historyStationList.length" >

          <VScroll class="historyScroll"

          :scrollingX=true

          :scrollingY=false

          >

          <div class="stationArea">

            <div

            class="stationLabel"

            v-for="(item, index) in historyStationList"

            :key="index"

            @click="clickHistoryStaion(index)"

            >

            <p>{{item["depCity"].deptCityName}}-{{item["arrCity"].arrCityName}} </p>

            </div>

          </div>

          </VScroll>

          <div class="clearHistoryList" @click="clearHistoryStation">

            清除历史

          </div>

        </div>

css部分:

.historyList{

  .flexbox;

  .flex-direction(row);

  font-size: 24*@rmw2;

  margin:12*@rmw2 -10*@rmw2 -10*@rmw2 -10*@rmw2;

  width: 100%;

  .historyScroll{

    width: 80%;

    .flexbox;

    .stationArea{

      .flexbox;

      .flex-direction(row);

      .align-items(center);

      height:40*@rmw2;

      padding:6*@rmw2 4*@rmw2;

      box-sizing: border-box;

      .stationLabel{

        color: #999;

        margin-right: 29*@rmw2;

        text-align: center;

        display: inline-block;

        p {

          white-space: nowrap;

        }

      }

  }

}

  .clearHistoryList{

    margin-left: 20*@rmw2;

    width: 20%;

    display: inline-block;

    color: #4b93ff;

    font-size: 24*@rmw2;

    margin-right: -0.32rem;

    height: 40*@rmw2;

    line-height: 40*@rmw2;

    margin-top: 0*@rmw2;

    text-align: right;

  }

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • H5移动端知识点总结 阅读目录 移动开发基本知识点 calc基本用法 box-sizing的理解及使用 理解dis...
    Mx勇阅读 10,105评论 0 26
  • 移动开发基本知识点 一.使用rem作为单位 html { font-size: 100px; } @media(m...
    横冲直撞666阅读 8,877评论 0 6
  • display:设置元素的显示方式 display:block(块级元素) 默认为父元素宽高,可设置宽高相对前序换...
    bluishwhiteC阅读 3,836评论 0 0
  • 1. tab列表折叠效果 html: 能源系统事业部 岗位名称: 工作地点 岗位名...
    lilyping阅读 5,882评论 0 1
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 6,831评论 0 11