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.
2. Import as a global component in the main.js file
<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: 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:
|
<<: Illustration of the process of using FileZilla to connect to the FTP server
>>: The difference between char and varchar in MYSQL
Purpose Understand the role of nextTick and sever...
Table of contents 1. Download the tomcat code 2. ...
Table of contents tool: Login scenario: practice:...
a : Indicates the starting or destination positio...
Introduction to Debian Debian in a broad sense re...
Preface In fact, I have never encountered this ki...
There are many XHTML tags: div, ul, li, dl, dt, d...
Correct answer Using useRouter : // router path: ...
The definition and inheritance of classes in JS a...
Table of contents 1. Decoupled assignment of arra...
This article shares the specific code of JavaScri...
Nowadays, copying websites is very common on the I...
When we want to add a shadow to a rectangle or ot...
Effect display The built-in boot interface is too...
Table of contents 1. Installation 1. Introduction...