Implementing circular scrolling list function based on Vue

Implementing circular scrolling list function based on Vue

Note: You need to give the parent container a height and :data='Array' and overfolw:hidden; scrolling left and right requires giving the ul container an initial css width.
Let's first introduce the usage of this component:
1. Installation command:

cnpm install vue-seamless-scroll --save

2. Import as a global component in the main.js file

import scroll from 'vue-seamless-scroll'

Vue.use(scroll)

insert image description here

<vue-seamless-scroll :data="listData" class="seamless-warp" :class-option="defaultOption">
        <ul class="item">
            <li v-for="item in listData">
                <span class="title" v-text="item.title"></span><span class="date" v-text="item.date"></span>
            </li>
        </ul>
    </vue-seamless-scroll>

CSS code:

<style lang="scss" scoped>
    .seamless-warp {
        height: 229px;
        overflow: hidden;
    }
</style>
<script>
    export default {
        data () {
            return {
                listData: [{
                   'title': 'Seamless scrolling first line Seamless scrolling first line',
                   'date': '2017-12-16'
                 }, {
                    'title': 'Seamless scrolling second line Seamless scrolling second line',
                    'date': '2017-12-16'
                 }, {
                     'title': 'Seamless scrolling third line Seamless scrolling third line',
                     'date': '2017-12-16'
                 }, {
                     'title': 'Seamless scrolling fourth line Seamless scrolling fourth line',
                     'date': '2017-12-16'
                 }, {
                     'title': 'Seamless scrolling fifth line Seamless scrolling fifth line',
                     'date': '2017-12-16'
                 }, {
                     'title': 'Seamless scrolling sixth line Seamless scrolling sixth line',
                     'date': '2017-12-16'
                 }, {
                     'title': 'Seamless scrolling seventh line Seamless scrolling seventh line',
                     'date': '2017-12-16'
                 }, {
                     'title': 'Seamless scrolling eighth line Seamless scrolling eighth line',
                     'date': '2017-12-16'
                 }, {
                     'title': 'Seamless scrolling ninth line Seamless scrolling ninth line',
                     'date': '2017-12-16'
                 }]
                }
            }
       }
</script>
computed: {
    defaultOption() {
      return {
        step: 0.6, // The larger the value, the faster the scrolling. hoverStop: true, // Whether to enable mouse hover stop
        direction: 1, // 0 down 1 up 2 left 3 right waitTime: 1000 // Single-step motion stop time (default 1000ms)
      }
    }
  }

The effect is as follows:

insert image description here

This is the end of this article about implementing a circular scrolling list function based on Vue. For more relevant Vue circular scrolling list content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to use v-for loop to generate dynamic tags in Vue.js
  • 7 Ways to Write a Vue v-for Loop
  • Attributes in vue v-for loop object
  • Detailed explanation of the loop form item example in Vue
  • An example of implementing a simple infinite loop scrolling animation in Vue
  • This article will show you the event loop mechanism of vue.js

<<:  Illustration of the process of using FileZilla to connect to the FTP server

>>:  The difference between char and varchar in MYSQL

Recommend

Flex layout realizes left text overflow and omits right text adaptation

I want to achieve a situation where the width of ...

Gearman + MySQL to achieve persistence operation example

This article uses the gearman+mysql method to imp...

Table of CSS Bugs Caused by hasLayout

IE has had problems for a long time. When everyone...

js drag and drop table to realize content calculation

This article example shares the specific code of ...

mysql 5.7.17 winx64.zip installation and configuration method graphic tutorial

Preface: I reinstalled win10 and organized the fi...

How to pull the docker image to view the version

To view the version and tag of the image, you nee...

Seven Principles of a Skilled Designer (1): Font Design

Well, you may be a design guru, or maybe that'...

Analysis of the use of Linux vulnerability scanning tool lynis

Preface: Lynis is a security audit and hardening ...

Should I use Bootstrap or jQuery Mobile for mobile web wap

Solving the problem Bootstrap is a CSS framework ...

How to build php+nginx+swoole+mysql+redis environment with docker

Operating system: Alibaba Cloud ESC instance cent...

A brief discussion on the Linux kernel's support for floating-point operations

Currently, most CPUs support floating-point units...

HTML meta usage examples

Example Usage Copy code The code is as follows: &l...

Solution to the problem of failure to insert emoji expressions into MySQL

Preface I always thought that UTF-8 was a univers...

Implementing a simple calculator with javascript

This article example shares the specific code of ...