uni-app公共组件

轮播组件(Carousel)

<!-- 轮播图组件 -->
<template>
    <view>
        <swiper class="swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
            <swiper-item v-for="item in imagelist" :key="item.Guid">
                <view class="swiper-item" >
                    <image :src="item.ImageUrl"></image>
                </view>
            </swiper-item>
            
        </swiper>
    </view>
</template>

<script>
    export default {
        props: ["imagelist"],
    }
</script>

<style>
    .swiper {
        height: 200px;
        width: 100%;
        
    }

    .swiper-item {
        height: 100%;
        width: 100%;
    }

    .swiper-item image {
        height: 100%;
        
    }
</style>
数据源
imagelist:[
                    {
                        "Guid": "24ac92f3-c85a-4a12-b6f8-846e473f4594",
                        'ImageUrl':'../../static/image/1.jpg'
                    },
                    {
                        "Guid": "24ac92f3-c85a-4a12-b6f8-846e473f4594",
                        'ImageUrl':'../../static/image/2.jpg'
                    },
                    {
                        "Guid": "24ac92f3-c85a-4a12-b6f8-846e473f4594",
                        'ImageUrl':'../../static/image/3.jpg'
                    }
                    
                ]
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容