mobile-pull-to-refresh: 移动端下拉刷新控件

发布时间:2019-07-02 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了mobile-pull-to-refresh: 移动端下拉刷新控件脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

GIThub: https://github.com/fenivana/p...

Pull to refresh

移动端下拉刷新控件. 体积小无依赖.

预览

请在手机版Chrome, Safari中查看, 或打开PC版Chrome DevTools的手机模拟器.

mobile-pull-to-refresh: 移动端下拉刷新控件

Material样式

mobile-pull-to-refresh: 移动端下拉刷新控件

Material样式2

mobile-pull-to-refresh: 移动端下拉刷新控件

iOS样式

如何使用

安装

npm install mobile-pull-to-refresh --save

引入JS和CSS (webpack 2)

import pullToRefresh From 'mobile-pull-to-refresh'

// Import the style you want

// MATErial
import ptrAnimatESMaterial from 'mobile-pull-to-refresh/dist/styles/material/animates'
import 'mobile-pull-to-refresh/dist/styles/material/style.css'

// Material 2
import ptrAnimatesMaterial2 from 'mobile-pull-to-refresh/dist/styles/material2/animates'
import 'mobile-pull-to-refresh/dist/styles/material2/style.css'

// iOS
import ptrAnimatesIos from 'mobile-pull-to-refresh/dist/styles/ios/animates'
import 'mobile-pull-to-refresh/dist/styles/ios/style.css'

HTML代码

请查看例子中的HTML文件.

@H_997_126@
  • Material style

  • Material style 2

  • iOS style

  • 调用

    pullToRefresh({
      container: document.querySelector('.container'),
      animates: ptrAnimatesMaterial,
      // animates: ptrAnimatesMaterial2,
      // animates: ptrAnimatesIos,
    
      refresh() {
        return new PRomise(resolve => {
          // here to fetch the data and rerender the contents.
          setTimeout(resolve, 2000)
        })
      }
    })

    许可

    MIT

    友情鸣谢

    脚本宝典总结

    以上是脚本宝典为你收集整理的mobile-pull-to-refresh: 移动端下拉刷新控件全部内容,希望文章能够帮你解决mobile-pull-to-refresh: 移动端下拉刷新控件所遇到的问题。

    如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

    本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
    如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。