源碼地址
https://github.com/ustbhuangyi/better-scroll.gitgit
原生滾動github
.hello { overflow-y: scroll; }
BetterScroll
ide
<script> import BetterScroll from 'better-scroll' export default { name: 'HelloWorld', mounted() { let bs = new BetterScroll('.hello', { }) } } </script>
<style scoped> .hello { overflow-y: hidden; background-color: antiquewhite; height: 200px; } </style>
它不只支持慣性滾動、邊界回彈、滾動條淡入淡出等效果的靈活配置,讓滾動更加流暢,同時還提供了不少 API 方法和事件code