zoukankan      html  css  js  c++  java
  • 移动端fixed布局兼容性不好,使用absolute布局来代替

    在移动端使用fixed布局存在兼容性问题,因此使用absolute布局来代替

    效果演示

    src/app.vue里打好框架

    <template>
      <div id="app" class="g-container">
        <div class="g-header-container">
          头部导航
        </div>
        <div class="g-view-container">
          <div class="content">
            内容区域
          </div>
          
        </div>
        <div class="g-footer-container">
          底部导航
        </div>
      </div>
    </template>
    
    <script>
      export default {
        name: 'App',
      }
    </script>
    
    <style scoped>
      .g-container{
        position: relative;
        100%;
        height:100%;
        max-640px;
        min-320px;
        margin:0 auto;
        overflow:hidden;  
      }
      .g-header-container{
        position:absolute;
        left:0;
        top:0;
        100%;
        z-index:999;
        height:64px;
        background:pink; 
      }
      .g-view-container{
        height:100%;
        padding-bottom:80px;
        background:lightblue;
        overflow:auto;
      }
      .content{
        height:2000px;
      }
      .g-footer-container{
        position:absolute;
        left:0;
        bottom:0;
        100%;
        box-shadow:0 0 10px 0 hsla(0,6%,58%,0.6);
        height:80px;
        z-index:999;
        background:lightgreen;
      }
    </style>

    在main.js里引入首页文件的样式index.scss

    // The Vue build version to load with the `import` command
    // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
    import 'babel-polyfill'
    import fastclick from 'fastclick'
    import Vue from 'vue'
    import App from './App'
    import router from './router'
    
    //给默认主页引入index.scss样式文件
    import 'assets/scss/index.scss';
    
    Vue.config.productionTip = false
    
    //给body元素设置fastclick
    fastclick.attach(document.body);
    
    /* eslint-disable no-new */
    new Vue({
      el: '#app',
      router,
      components: { App },
      template: '<App/>'
    })

    assets/scss/index.scss

    *{
        margin:0;
        padding:0;
    }
    html,body{
        // 必须设置,否则内容滚动效果无法实现
        100%;
        height:100%;
    }
  • 相关阅读:
    测试Hibernate的DAO方法
    MyBatis 一对一关系映射
    MyBatis 实现基本CRUD操作
    配置日志框架——Log4j
    MyBatis 基础配置
    Hibernate与 MyBatis的比较
    关于用JSON拼凑出来的DOM对象的操作以及EasyUI的提交方式
    Struts2 单例与多例
    SpringMVC rest风格的url
    SpringMVC 控制器之对ServletAPI的支持与对JSON的支持
  • 原文地址:https://www.cnblogs.com/chenyingying0/p/12639615.html
Copyright © 2011-2022 走看看