<template>
	<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
		:duration="duration">
		<swiper-item v-for="bannerItem in carouselList">
			<!-- <uni-link :href="bannerItem.destinationAddress?bannerItem.destinationAddress:'#'"> -->
			<image :src="bannerItem.filePath" mode="widthFix" @click="jumpUrl(bannerItem.destinationAddress)"></image>
			<!-- </uni-link> -->
		</swiper-item>
	</swiper>
</template>

<script>
	export default {
		props: ['carouselList'],
		data() {
			return {
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
			}
		},
		name: 'carousel',
		components: {},
		mounted() {
			
		},
		methods: {
			jumpUrl(url) {
				if (!url) {
					return false
				} else {
					let index = url.indexOf('/appYdhomeoffice/pages/');
					if (index != -1) {
						uni.navigateTo({
							url: url.substring(index + 16, url.length)
						})
					} else {
						// #ifdef H5
						window.location.href = url;
						// #endif
						// #ifdef APP-PLUS
						uni.navigateTo({
							url: '/components/webview?url=' + url
							// page.json定义的路径 传url 到webview界面去接收 实现跳转
						})
						//#endif
					}

				}
			}

		}
	}
</script>

<style lang="scss">
	.swiper {
		height: 228rpx;
	}
</style>