zoukankan      html  css  js  c++  java
  • VUE iscroll(银联二维码,浩哥页面用过)

    基本使用方法:

    $ npm i vue-iscroll-view --save-dev
    $ npm i iscroll --save-dev

      

    import IScrollView from 'vue-iscroll-view'
    
    /* Using these kinds of IScroll class for different cases. */
    import IScroll from 'iscroll'
    // import IScroll from 'iscroll/build/iscroll-infinite.js
    // import IScroll from 'iscroll/build/iscroll-probe.js
    // import IScroll from 'iscroll/build/iscroll-view.js
    // import IScroll from 'iscroll/build/iscroll-zoom.js
    // import IScroll from 'iscroll/build/iscroll-lite.js
    
    Vue.use(IScrollView, IScroll)
    

      

    <template>
      <iscroll-view class="scroll-view">
        Your contents
      </iscroll-view>
    </tempalte>
    
    <style>
    .scroll-view {
      /* -- Attention: This line is extremely important in chrome 55+! -- */
      touch-action: none;
      /* -- Attention-- */
      position: fixed;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      overflow: hidden;
    }
    </style>
    

      

    手机上不能点击的处理办法

    <template>
      <iscroll-view :options="{preventDefault: false}">
        Your contents
      </iscroll-view>
    </tempalte>
    

      

    滚动事件

    <template>
      <iscroll-view @scrollStart="log">
        Your contents
      </iscroll-view>
    </tempalte>
    
    <script>
    export default {
      methods: {
        log (iscroll) {
          console.log(iscroll)
        }
      }
    }
    </script>
    

      

    返回顶部

    <template>
      <div>
        <iscroll-view ref="iscroll">
          Your contents
        </iscroll-view>
        <button @click="scrollToTop">Scroll To Top</button>
      </div>
    </tempalte>
    
    <script>
    export default {
      methods: {
        scrollToTop () {
          const iscroll = this.$refs.iscroll
          iscroll.scrollTo(0, 0, 100)
          iscroll.refresh()
        }
      }
    }
    </script>
    

      

    上拉下拉事件

    <template>
      <iscroll-view @pullUp="load" @pullDown="refresh">
        Your contents
      </iscroll-view>
    </tempalte>
    
    <script>
    export default {
      methods: {
        refresh (iscroll) {
          // Refresh current data
        },
        load (iscroll) {
          // Load new data
        }
      }
    }
    </script>
    

      

    转自:http://blog.csdn.net/weixin_38788947/article/details/77447785?fps=1&locationNum=3

  • 相关阅读:
    洛谷P1469 找筷子(异或)
    洛谷P1464 Function(记忆化)
    洛谷P2895 [USACO08FEB]Meteor Shower S(BFS)
    细讲递归(recursion)
    博客美化总结(持续更新)
    OneDrive撸5T硬盘空间教程
    标准I/O库(详解)(Standard I/O Library)
    C++(SOCKET)简单爬虫制作
    #include <bits/stdc++.h>头文件
    Windows 10家庭版升级到专业版,系统蓝屏
  • 原文地址:https://www.cnblogs.com/ourLifes/p/8386744.html
Copyright © 2011-2022 走看看