Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@zhangzhengyi12/vue-scrollbars
Advanced tools
基于 Vue 的 PC 端滚动组件 简单 轻量 高效 仅对原生滚动组件进行滚动条样式统一化处理,并添加自动隐藏,拖动滚动等常用功能,利用动态滚动宽度监测来填平平台之间的差异
if you like , click star , thanks!
使用示例请看 app.vue
sudo npm i @zhangzhengyi12/vue-scrollbars --svae
global regisiter
import Vue from 'vue'
import Scrollerbars from '@zhangzhengyi12/vue-scrollbars'
Vue.use(Scrollerbars)
OR in component
import Scrollerbars from '@zhangzhengyi12/vue-scrollbars'
// in vue component
export default {
components: { Scrollerbars }
}
<scrollbars style="height:200px" autoHide>
<!-- you content -->
</scrollerbars>
name | type | desc | default |
---|---|---|---|
autoHide | Boolean | auto hide scrollbar | false |
hideTime | Boolean | auto Hide Time | 1000 |
data | Array | on watch Data Change refresh Bar | [] |
displayBar | Boolen | display scrollbar | true |
listenScrollBottom | Function | Called when scrolling to the bottom | false |
scrollBottomHeight | Number | listenScrollBottom handler trigger height | 50 |
listenScrollRight | Function | Called when scrolling to the right | false |
scrollBottomHeight | Number | listenScrollRight handler trigger height | 50 |
name | params | desc |
---|---|---|
refresh() | null | refersh scrollbar |
this.$refs.scrollbars.refresh()
name | params | desc |
---|---|---|
@scroll | scroll event object | native scroll Event |
这里了解这个组件的原理是利用 容器的 Overflow:hidden 属性 ,随后将 content 设置一个负的 marigin-bottom & margin-right 把滚动条顶出容器 已达到隐藏的效果 (一般来说这个值就是滚动条的宽度),但是在不同平台的不同设备上,这个宽度是不一致的,在我的 mbp15 inch 上 这个值是 15 像素,而在一台 windows 分辨率 1920*1080 的设备上,这个宽度为 17
The principle of understanding this component here is to use the container's Overflow:hidden property, and then set the content to a negative marigin-bottom & margin-right. The scroll bar is pushed out of the container to achieve a hidden effect (generally this value is the scroll bar) Width), but this width is inconsistent on different devices on different platforms. This value is 15 pixels on my mbp15 inch, and on a 1920*1080 windows resolution, this width is 17
所以我加入了一个动态检测滚动条宽度的功能,能够让滚动条自动适应你的设备
So I added a feature that dynamically detects the width of the scrollbar, allowing the scrollbar to automatically adapt to your device.
考虑再三还是还是没有加入 bar 的颜色等常用 Props, 如有需要,请使用样式优先级进行覆盖。
FAQs
基于 Vue 的 PC 端滚动组件 简单 轻量 高效
We found that @zhangzhengyi12/vue-scrollbars demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.