Giter Site home page Giter Site logo

vue-noscroll-layer's Introduction

vue-noscroll-layer

弹层禁止滚动,滚动穿透

Install

npm install no-scroll-layer  -S

Quick Start

在main.js 注册插件 使其成为一个全局指令
import Vue from 'vue'
import noScroll from 'no-scroll-layer'
 Vue.use(noScroll)

// 全局指令 v-noScroll 之后在每个xx.vue 文件中 写法如下
export default {
  data() {
    return {
        // 控制显示弹层
      showLayer: false
    }
  }
}
1. 自身无滚动
<div class="mask"  v-no-scroll="{showLayer}" v-show="showLayer">
    // 写你的结构
</div>

2. 自身有滚动
<div class="mask"  v-no-scroll="{showLayer,parentEl:'scroll-el'}" v-show="showLayer">
    <div id="scroll-el">
        <ul>
          <li></li>
        </ul>
    </div>
</div>
    div.mask 是蒙层
  div.scroll-el 是固定高度的父窗体,ul>li 是滚动体
  要给固定高度的父窗体设置如下样式
  #scroll-el {
    height: 300px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

vue-noscroll-layer's People

Contributors

xintairuan avatar qinmao avatar

Watchers

James Cloos avatar

Forkers

limingziqiang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.