Joe
11 months ago
4 changed files with 164 additions and 10 deletions
@ -1,5 +1,6 @@ |
|||
{ |
|||
"dependencies": { |
|||
"flv.js": "^1.6.2" |
|||
"flv.js": "^1.6.2", |
|||
"vue-slick-carousel": "^1.0.6" |
|||
} |
|||
} |
|||
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,112 @@ |
|||
<template> |
|||
<div class="Carousel"> |
|||
<img src="./images/arrow.svg" @click="prevSlide" class="arrow" /> |
|||
|
|||
<VueSlickCarousel v-bind="settings" ref="CarouselRef" class="vueSlickCarousel"> |
|||
<div v-for="(item, index) in carouselItems" :key="index" class="item"> |
|||
<img :src="require(`@screen/images/${item.imageURL}`)" style="height: 100%"> |
|||
</div> |
|||
</VueSlickCarousel> |
|||
|
|||
<img src="./images/arrow.svg" @click="nextSlide" class="arrow" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
import VueSlickCarousel from 'vue-slick-carousel' |
|||
import 'vue-slick-carousel/dist/vue-slick-carousel.css' |
|||
// optional style for arrows & dots |
|||
import 'vue-slick-carousel/dist/vue-slick-carousel-theme.css' |
|||
|
|||
export default { |
|||
name: "Carousel", |
|||
components: { VueSlickCarousel }, |
|||
data() { |
|||
return { |
|||
carouselItems: [ |
|||
{ |
|||
"imageURL": "shareWith/message-active.svg" |
|||
}, |
|||
{ |
|||
"imageURL": "shareWith/message.svg" |
|||
}, |
|||
{ |
|||
"imageURL": "shareWith/phone-active.svg" |
|||
}, |
|||
{ |
|||
"imageURL": "shareWith/phone.svg" |
|||
}, |
|||
{ |
|||
"imageURL": "shareWith/website-active.svg" |
|||
}, |
|||
{ |
|||
"imageURL": "shareWith/website.svg" |
|||
}, |
|||
{ |
|||
"imageURL": "shareWith/weChat-active.svg" |
|||
}, |
|||
{ |
|||
"imageURL": "shareWith/weChat-active.svg" |
|||
} |
|||
], |
|||
settings: { |
|||
infinite: true, |
|||
arrows: false, |
|||
speed: 600, |
|||
slidesToShow: 3, |
|||
slidesToScroll: 1, |
|||
autoplay: true, |
|||
autoplaySpeed: 1800, |
|||
}, |
|||
} |
|||
}, |
|||
methods: { |
|||
prevSlide() { |
|||
this.$refs.CarouselRef.prev() |
|||
}, |
|||
nextSlide() { |
|||
this.$refs.CarouselRef.next() |
|||
}, |
|||
}, |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.Carousel { |
|||
width: 100%; |
|||
overflow: hidden; |
|||
display: flex; |
|||
gap: 9px; |
|||
|
|||
.vueSlickCarousel { |
|||
flex: 1; |
|||
overflow: hidden; |
|||
|
|||
::v-deep { |
|||
.slick-list { |
|||
height: 100%; |
|||
|
|||
div { |
|||
height: 100%; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.item { |
|||
img { |
|||
height: 100%; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.arrow { |
|||
cursor: pointer; |
|||
width: 15px; |
|||
|
|||
&:first-child { |
|||
transform: rotate(-180deg) |
|||
} |
|||
} |
|||
} |
|||
</style> |
Loading…
Reference in new issue