微信小程序,基于uni-app的轮播图制作,调用文件中图片

以便捷为目的,想使用文件中的图片制作轮播图

但网上找到的都是轮播图彼此分割,没有使用数组存储在一起,不便于管理,代码不美观简洁

作者使用文件中的图片,并使用数组制作轮播图的具体操作如下:(任一页面的.vue文件,完整简洁代码)

bash 复制代码
<template>
	<swiper>
		<swiper-item v-for = "item in picture" :key="item.id">
			<view>
				<image :src = "item.img"></image>
			</view>
		</swiper-item>
	</swiper>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello uni',
				
				//轮播图数据
				picture : [
					{ id: '1', img: "/static/tabs/home_default.png"},
					{ id: '2', img: "/static/tabs/home_selected.png"}
				]
			}

		},
		onLoad() {

		},
		methods: {

		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
相关推荐
于先生吖15 小时前
前后端分离二手商城开发,质检登记、回收回款整套业务源码部署教程
java·开发语言·uni-app
嫂子的姐夫20 小时前
050-wx小程序合肥住房
爬虫·python·小程序·逆向
Geek_Vison1 天前
政务一网通APP如何引入AI能力,通过一个AI助手就能够调用所有的功能,实现对话即办事
人工智能·ai·小程序·uni-app·小程序容器
黄华SJ520it1 天前
跨境分销小程序:全球市场新机遇
小程序·系统开发
爱分享的小诺1 天前
微信小程序2.0人脸审核,1.0升级到2.0
微信小程序·小程序
打瞌睡的朱尤1 天前
微信小程序(黑马)4-5
微信小程序·小程序
海兰1 天前
【小程序】基于 AI 大语言模型驱动的中国古典诗词 Web 应用详细设计指南
人工智能·语言模型·小程序
凌奕2 天前
微信小程序接入微信 AI:让用户"说一句话"就能下单
微信·微信小程序·agent
倒流时光三十年2 天前
第十八章 搜索历史保存功能实现记录
spring boot·微信小程序
倒流时光三十年2 天前
第十七章 投票页面增加搜索功能
spring boot·微信小程序