New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

vue-scroll-view-mobile

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-scroll-view-mobile

scroll-view component for mobile

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

vue-scroll-view-mobile

一个基于vue2.0.js移动端的原生scroll组件, 由原来的native-scroll更名为vue-scroll-view-mobile,添加事件节流,时间间隔600ms,提升性能;优化了缓动动画效果

安装

npm 安装


  npm install vue-scroll-view-mobile --save

注册组件

全局注册

  • -- main.js
    
    import Vue from 'vue'
    import {ScrollView} from 'vue-scroll-view-mobile'
    Vue.use(ScrollView)

  • -- Hello.vue
   <template>
     <div class="section" ref="scrollView">
      <native-scroll>
       <!-- 你的内容 -->
      </native-scroll>
     </div>
   </template>
   <style lang="scss">
    .section {
      // 必须要有一个高度
      position: fixed;
      width: 100%;
      height: 500px;
    }
   </style>

方法/事件

scroll

  • 类型function

  • 用法:

    <!-- 商品详情页面  -->
    <section class="section">
     <native-scroll ref="myScroll" @scrolling="onScroll" @scroll-lower="nextPage">
      <!-- 其他内容 -->
      
      <section class="detail" ref="detail">
       <!-- 商品图文介绍  -->
      </section>
     </native-scroll>
    </section>
    
    methods: {
     onScroll(pos) {
      // 未做节流处理
      console.log(pos)
     },
     nextPage() {
      // this.$axios....
     },
     // 返回顶部
     goBack() {
      this.$refs.myScroll.scrollTo(0)
     }
     // 去到制定dom节点位置
      goElement() {
       this.$refs.myScroll.scrollToElement(this.$refs.detail)
      }
    }
    <style lang="scss">
      .section {
        // 必须要有一个高度
        width: 100%;
        height: 500px;
      }
     </style>
    

For detailed explanation on how things work, consult the docs for vue-loader.

Keywords

vue

FAQs

Package last updated on 05 May 2020

Did you know?

Socket

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.

Install

Related posts