Coder Social home page Coder Social logo

yangqihua / vue-scroll-mobile-demo Goto Github PK

View Code? Open in Web Editor NEW
278.0 17.0 66.0 19.24 MB

web app 主流 scroll view/瀑布流/无限加载插件用法及对比,无限加载终极解决方案

Home Page: http://118.31.20.214/scroll-demo

License: MIT License

JavaScript 75.83% HTML 11.55% Vue 8.18% CSS 4.44%
vue scrollview-component refresh vux webapp h5 better-scroll

vue-scroll-mobile-demo's Introduction

vue-scroll-mobile-demo

  • 该项目是一个演示了 web app 各大【scroll view】主流插件的用法,主要面向 vue 项目开发者,使用 vux 作为项目骨架,scroll view 采用图文的方式进行布局,可以无限加载数据,用于测试各大插件在滑动的过程中是否卡顿,滑动效果是否自然,比较了8种较为主流的 scroll view 插件(具体见插件比较),并对 mescroll 进行了源代码上的封装,对 better-scroll 进行了使用上的封装。

1.扫码快速体验(使用手机浏览器打开)

二维码

2.安装与运行

  npm install
  npm run dev

3.项目打包

  npm run build

4.演示部分界面截图(4种,其他插件效果安装体验)

图一加载失败    图二加载失败

图三加载失败 图四加载失败

5.插件比较

scroll view 8款插件比较
插件名称 GitHub 说明
vux https://github.com/airyland/vux 基于 vue 与 weui 移动端组件库,但该 scroller 组件官方称已经不再维护,建议使用第三方插件。优点:无论 Android 还是 iOS,scroll view 都可以产生回弹效果,缺点:滑动卡顿、不自然,局限于 vux 框架之中
better-scroll https://github.com/ustbhuangyi/better-scroll 算是 GitHub 上 star 最多的插件了,很多项目在使用,详细介绍见官网。优点:作者更新频繁,非常上心(上次我凌晨2点多提了个issue,十分钟之后就回复了),使用者较多,功能也非常丰富,具有有回弹效果,纯文字列表滑动也比较自然。缺点:官方文档较为简陋(仅仅是一些参数的介绍),基于vue的demo对初学者来说难度稍大,图文列表滑动不太自然,且加载的数据越多越为明显,尤其是在低端安卓机或iPhone5/6上滑动过程中会跳跃式的回闪
vue-scroller https://github.com/wangdahoo/vue-scroller 基于 Vue 的 滑动插件,支持下拉刷新和上拉加载,支持自定义下拉刷新/上拉加载/无数据 dom 等。优点:具有有回弹效果,使用简单,官方demo齐,上手较为简单。缺点:图文列表,当数据加载到一定程度后会比较卡顿;使用上仅限于vue
mescroll https://github.com/mescroll/mescroll 精致的下拉刷新和上拉加载 js框架.支持vue,完美运行于移动端和主流PC浏览器,定制化非常高,默认UI很精致。优点:文档齐全,官方例子非常多,非常容易使用,具有回到顶部等贴心功能。缺点:无回弹效果,在iOS上使用下拉刷新会与iOS浏览器默认回弹效果冲突
vue-infinite-scroll https://github.com/ElemeFE/vue-infinite-scroll 饿了么出品,封装成 vue 指令,代码简洁,但是功能较为简单。优点:可对源代码进行定制化开发。缺点:功能非常简单,仅支持无限加载,且不能定制化dom
vue-infinite-loading https://github.com/PeachScript/vue-infinite-loading 功能和 vue-infinite-scroll 类似,仅支持无限加载,但是以组件方式进行封装。优点:代码简明易懂,有官方示例,文档齐全,支持横向scroll。缺点:功能简单,不支持下拉刷新,仅限于vue
VueMugenScroll https://github.com/egoist/vue-mugen-scroll 一款无限加载插件,使用上也比较简单。优点:参数较少,新手比较容易上手。缺点:功能单一,不支持下拉刷新,仅限于vue
Scrollload https://github.com/fa-ge/Scrollload 一款下拉刷新,上拉加载的移动端插件,无任何依赖,对iOS局部滚动的坑进行了较为全面的分析。优点:示例丰富,对iOS回弹效果和项目回弹效果的冲突提出了较为全面的解决方案。缺点:对vue的支持不是很友好,解决局部滚动问题会依赖于其他库

6.总结

  • 1.scroll view 插件非常多,但实现方式无非是两种

    • 1-1.自己使用 css3 transform 来实现滚动动画,可以很好的实现回弹效果,但很难掌控,所以会造成滑动不自然,上述插件vux、better-scroll、vue-scroller都是使用的该方案
    • 1-2.使用原生div效果(overflow-y:auto)来实现滑动,滑动效果会较为自然,但安卓上无回弹效果,且滑动事件易于iOS默认滑动事件冲突,上述插件其余5种使用的该方案。
  • 2.better-scroll 官方demo相对新手来说较为复杂,vue-scroll-mobile-demo 中对 better-scroll 进行了使用上的封装(基于vue)

  • 3.mescroll 在 vue 中使用存在一些弊端(如组件在deactivated时未注销滑动事件,在deactivated时未销毁回到顶部图片),vue-scroll-mobile-demo 对 mescroll 的源代码进行了相应的完善。

  • 4.个人观点:项目中 scroll view 为文字列表且滚动加载数据较少时,可使用 better-scroll,毕竟滴滴也在用,使用者很多。项目中 scroll view 为图文列表时,且需要无限加载数据时使用 mescroll,可参照官方示例。

vue-scroll-mobile-demo's People

Contributors

yangqihua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-scroll-mobile-demo's Issues

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.