123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <template>
-
- <swiper
- :interval="3000"
- :duration="1000"
- :indicator-dots="true"
- :current="current" @change="swiperTab"
- :autoplay="true"
- :circular="true"
- class="swiper"
- >
- <swiper-item v-for="(item,index) in dataList" :key="index">
- <image :src="item.url" class="swiper-img" mode="aspectFill"></image>
- </swiper-item>
- </swiper>
- </template>
- <script>
- export default {
- name: "yf-carsousel",
- props:{
- imgList: {
- type: Array,
- default() {
- return []
- }
- }
- },
- data() {
- return {
- current: 0,
- dataList: []
- }
- },
- watch: {
- imgList: {
- handler(val) {
- console.log('watch....', val)
- this.dataList = val
- },
- deep: true
- }
- },
- mounted() {
- this.dataList = this.imgList
- },
- methods: {
- swiperTab(e) {
- var that = this;
- this.current = Number(e.target.current);
- }
- }
- }
- </script>
- <style>
-
- .swiper, .swiper-img {
- width: 100vw;
- height: 45vw;
- }
-
- </style>
|