xzrkz-web/src/pages/Index/components/Swiper.vue

64 lines
1.4 KiB
Vue
Raw Normal View History

2020-06-07 10:28:34 +08:00
<template>
<div class="index-swiper">
2020-06-10 11:19:26 +08:00
<swiper ref="mySwiper" :options="swiperOptions" class="swiper-outer">
2020-07-03 15:52:11 +08:00
<swiper-slide class="swiper-box" v-for="(swiper,idx) in swiperList" :key="idx">
2020-07-14 16:14:54 +08:00
<img :src="url + 'news/route/file/downloadfile/false/' + swiper.newsContentCoverList" alt="" class="banner-img" @click="goDetail(swiper.templateRecordUrl)">
2020-06-07 10:28:34 +08:00
</swiper-slide>
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
</div>
</template>
<script>
2020-07-11 14:45:34 +08:00
import common from '@/common/components/common.js'
2020-06-07 10:28:34 +08:00
export default {
name: 'IndexSwiper',
props: {
2020-07-03 15:52:11 +08:00
swiperList: Array
2020-06-07 10:28:34 +08:00
},
data () {
return {
swiperOptions: {
pagination: '.swiper-pagination',
2020-07-14 16:14:54 +08:00
// loop: true,
2020-06-07 10:28:34 +08:00
autoplay: 3000
2020-07-11 14:45:34 +08:00
},
url: common.url
2020-06-07 10:28:34 +08:00
}
2020-07-14 16:14:54 +08:00
},
methods: {
goDetail: function (url) {
window.location.href = this.url + url
}
2020-06-07 10:28:34 +08:00
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus" scoped>
.index-swiper
width 100%
min-width 1200px
2020-07-15 11:22:49 +08:00
height 500px
2020-06-07 10:28:34 +08:00
position relative
min-height 375px
box-sizing border-box
&:after
content ''
display block
position absolute
top 0
left 0
width 100%
height 100%
background url("../../../assets/images/loading.gif") center no-repeat
z-index -1
2020-06-10 11:19:26 +08:00
.swiper-outer
width 100%
height 100%
.swiper-box
2020-07-14 16:14:54 +08:00
cursor pointer
2020-06-10 11:19:26 +08:00
.banner-img
width 100%
height 100%
2020-06-07 10:28:34 +08:00
</style>