热门
最新
红包
立Flag
投票
同城
我的
发布
小程序P99 05.首页-轮播图效果(接上一个)
!!!现在的正确接口是$http.baseUrl = 'https://api-ugo-web.itheima.net'
3.2.2 渲染轮播图的 UI 结构
//home.vue文件
渲染 UI 结构:
<template>
<view>
<!-- 轮播图区域 -->
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
<!-- 循环渲染轮播图的 item 项 -->
<swiper-item v-for="(item, i) in swiperList" :key="i">
<view class="swiper-item">
<!-- 动态绑定图片的 src 属性 -->
<image :src="item.image_src"></image>
</view>
</swiper-item>
</swiper>
</view>
</template>
美化 UI 结构:
<style lang="scss">
swiper {
height: 330rpx;
.swiper-item,
image {
width: 100%;
height: 100%;
}
}
</style>
CSDN App 扫码分享
评论
1
打赏
- 复制链接
- 举报