| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <template>
- <swiper :style="getStyle" indicator-dots :interval="3000" :duration="1000" autoplay circular indicator-color='#fff'>
- <swiper-item @tap="jump(item, index)" v-for="(item, index) in swipers" :key='index'>
- <view>
- <image class="img" :style="getStyle" :src="item.src" lazy-load mode=""></image>
- </view>
- </swiper-item>
- </swiper>
- </template>
- <script>
- export default {
- props: {
- swipers: {
- type: Array,
- default: () => []
- },
- heights: {
- type: String,
- default: '280'
- },
- // 判断点击是预览还是其他 默认 false
- proview: {
- type: Boolean,
- default: false
- }
- },
- computed: {
- getStyle() {
- return `height: ${this.heights}rpx`
- }
- },
- mounted() {},
- methods: {
- jump(item, index) {
- if (this.proview) {
- console.log('预览');
- } else {
- this.$emit('jump', item)
- }
- }
- }
- }
- </script>
- <style scoped>
- .img {
- width: 750rpx;
- }
- </style>
|