This article mainly introduces the use of vue carousel chart plug-in vue-concise-slider. Now I will share it with you and give you a reference.
vue-concise-slider
vue-concise-slider, a simple sliding component with simple configuration, supports adaptive/full-screen button paging, and is also compatible with mobile terminals And PC version
v2.4.7 supports vue2.0
Features
Simple configuration
Lightweight (~24kB gzipped)
Multiple sliding styles
Currently implemented
Full screen adaptive
Mobile compatible
Vertical scrolling
Timing automatic switching
Indefinite width scrolling
Seamless loop scrolling
Multi-level scrolling
Gradient scrolling
Rotation scrolling
Add customization to the page Component
will be implemented in the future
Gradient scrolling
Parallax effect
Link
Documentation
demo
Installation
npm install vue-concise-slider --save
How to use
<template>
<!-- 制作一个框架包裹slider -->
<p style="width:70%;margin:20px auto;height:400px">
<!-- 配置slider组件 -->
<slider :pages="pages" :sliderinit="sliderinit" @slide='slide' @tap='onTap' @init='onInit'>
<!-- 设置loading,可自定义 -->
<p slot="loading">loading...</p>
</slider>
</p>
</template>
<script>
import slider from 'vue-concise-slider'// import slider components
export default {
el: '#app',
data () {
return {
//Image list
pages:[
{
html: '<p class="slider1">slider1</p>',
style: {
'background': '#1bbc9b'
}
},
{
html: '<p class="slider2">slider2</p>',
style: {
'background': '#4bbfc3'
}
},
{
html: '<p class="slider3">slider3</p>',
style: {
'background': '#7baabe'
}
}
],
//Sliding configuration [obj]
sliderinit: {
currentPage: 0,
thresholdDistance: 500,
thresholdTime: 100,
autoplay:1000,
loop:true,
direction:'vertical',
infinite:1,
slidesToScroll:1,
timingFunction: 'ease',
duration: 300
}
}
},
components: {
slider
},
methods: {
// Listener event
slide (data) {
console.log(data)
},
onTap (data) {
console.log(data)
},
onInit (data) {
console.log(data)
}
}
}
</script>The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
A brief discussion on the application scenarios of Vue’s built-in component components
A simple tutorial on using less in vue2
vue-cli scaffolding-configuration file under bulid
The above is the detailed content of Use of vue carousel chart plug-in vue-concise-slider. For more information, please follow other related articles on the PHP Chinese website!