swiper.vue 1.13 KB
<template>
	<div class="swiper-box" v-if="swipers && swipers.list">
		<swipe class="swipe" :auto="5000" :showIndicators="false" @change="swiperChange">
			<swipe-item class="swipe-item" v-for="(item, index) in swipers.list" :key="index">
				<div class="item" @click="toDetail(item)">
					<div class="img-box">
						<img v-lazy="item.simg + SIGN.BIG" class="img" mode="widthFix" />
					</div>
				</div>
			</swipe-item>
		</swipe>
	</div>
</template>

<script>

	// 引入组件
	import { Swipe, SwipeItem } from 'mint-ui';

	export default {
		data() {
			return {

			}
		},
		props: ["swipers", "funcs"],
		components: {
			Swipe,
            SwipeItem
		},
		methods: {
			
			/**
			 * 跳转详情页
			 * @param {object} goods [商品详情对象]
			 */
			toDetail(goods) {
				if (typeof this.funcs === "object" && typeof this.funcs.toDetail === "function") {
					this.funcs.toDetail(goods);
				}
			},

			/**
			 * 当swiper切换
			 */
			swiperChange() {
				
			}
		}
	}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less" scoped>
    @import './swiper';
</style>