Home > Web Front-end > JS Tutorial > How to achieve seamless scrolling effect using vue.js

How to achieve seamless scrolling effect using vue.js

亚连
Release: 2018-06-09 14:42:25
Original
3356 people have browsed it

This article mainly introduces a seamless scrolling effect based on vue.js. The article introduces it to you in very detail and has reference value. Friends in need can refer to

A simple one based on vue. Seamless scrolling of js

:feet:Online document demo:ear_of_rice:Small demo:blue_book:English Document

Installation

NPM

##npm install vue-seamless-scroll --save

Use

ES6

Detailed demo page example-src/App.vue

// **main.js**
import Vue from 'vue'
import scroll from 'vue-seamless-scroll'
Vue.use(scroll)
<template>
 <vue-seamless-scroll></vue-seamless-scroll>
</template>
// 或者你可以自己设置全局注册的组件名 默认注册的组件名是 vue-seamless-scroll
Vue.use(scroll,{componentName: &#39;scroll-seamless&#39;})
<template>
 <scroll-seamless></scroll-seamless>
</template>
Copy after login

Common usage (script tag introduction)

Example:

Detailed demo page test/test.html

<html>
<head>
 ...
</head>
<body>
 <p id="app">
  <vue-seamless-scroll></vue-seamless-scroll>
 </p>
 <script src="vue.js"></script>
 <script src="vue-seamless-scroll"></script>
 <script>
  new Vue({
   el: &#39;#app&#39;
  })
 </script>
</body>
</html>
Copy after login

Configuration item default value

defaultOption () {
    return {
     step: 1, //数值越大速度滚动越快
     limitMoveNum: 5, //开始无缝滚动的数据量 //this.dataList.length
     hoverStop: true, //是否开启鼠标悬停stop
     direction: 1, // 0向下 1向上 2向左 3向右
     openWatch: true, //开启数据实时监控刷新dom
     singleHeight: 0, //单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
     singleWidth: 0, //单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
     waitTime: 1000 //单步运动停止的时间(默认值1000ms)
    }
   }
Copy after login

The above is what I compiled for everyone. I hope that in the future It will be helpful to everyone.

Related articles:

AngularJS two-way data binding principle (detailed tutorial)

How to calculate polygon centroid in JavaScript

How to use switch selector in WeChat applet

Detailed interpretation of Angular error 404 issues

How to use the slider component in WeChat applet

The above is the detailed content of How to achieve seamless scrolling effect using vue.js. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template