vue-scroll-lock
vue-scroll-lock
一个 VUE 组件:子元素 scroll 父元素容器不跟随滚动(兼容PC、移动端)
【 React 请移步 react-scroll-lock-component 】
文档 & 例子
使用
npm install vue-scroll-lock --save
// or
yarn add vue-scroll-lock
// main.js
import VueScrollLock from 'vue-scroll-lock'
Vue.use(VueScrollLock)
// ***.vue
<scroll-lock>
<div class="content">
// ...something
</div>
</scroll-lock>
| 参数 | 描述 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| lock | 是否阻止父级滚动 | Boolean | true/false | true |
| bodyLock | 是否阻止body容器滚动 | Boolean | true/false | false |
贡献
欢迎 Star、PR
// install
npm install | yarn
// dev
npm run dev
THANKS
移动端的实现参考张鑫旭的web移动端浮层滚动阻止window窗体滚动JS/CSS处理
LICENSE
MIT
Related Packages
vue-prevent-parent-scroll
A Vue directive that prevents vertical scrolling outside the current element whe...
15,247
20
vue-dragscroll
vue directive to make a scrollable element scroll by draging to the scroll direc...
1,541,547
264
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.0.6 | ^2.5.9 | ISC | |
| 0.0.5 | ^2.5.9 | ISC | |
| 0.0.4 | ^2.5.9 | ISC | |
| 0.0.3 | ^2.5.9 | ISC | |
| 0.0.2 | ^2.5.9 | ISC | |
| 0.0.1 | ^2.4.4 | ISC |