vue --- > mintUI中Swipe(轮播图)的使用

本文介绍了如何在Vue项目中使用MintUI的Swipe组件来实现轮播图功能,包括引入组件、在页面中放置、设定轮播图高度以及自定义每张图片的样式。
摘要由CSDN通过智能技术生成

引入

// main.js
// 导入包
import { Swipe, SwipeItem } from 'mint-ui'

// 注册
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);

放在需要显示的位置

// HomeContainer.vue(首页 -> 组件)
<template>
    <div>
        <!-- 轮播图区域 -->
        <mt-swipe :auto="4000">
            <mt-swipe-item>1</mt-swipe-item>
            <mt-swipe-item>2</mt-swipe-item>
            <mt-swipe-item>3</mt-swipe-item>
        </mt-swipe>
    </div>
</template>

轮播图需要高度

// HomeContainer.vue
<template>
...
</template>

<style lang="scss" scoped>
    .mint-swipe {
        height: 200px;
    }
</style>

设置轮播图每一张图片的颜色

// css写法
<style lang='scss' scoped>
    .mt-swipe-item:nt
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值