微信小程序之横向列表展示

效果图

参考微信小程序可看

代码:

复制代码
<view class="lbtClass">
	<view class="swiper-container">
		<scroll-view class="swiper" scroll-x="true" :scroll-left="scrollLeft">
		  <block v-for="(six,index) in TypeSixList" :key="index">
			        <view class="swiper-item">
			          <image :src="six.pic" class="slide-image"></image>
					  <view class="Mengc">
					  	{{six.name}}
					  </view>
			        </view>
			      </block>
			    </scroll-view>
			</view>
		</view>

js:

复制代码
export default {
 
       data(){
             return {
				  TypeSixList:[],//图片集合
                  scrollLeft:0,
                    typeId:"2"

			  }
         },
       onLoad() {
		 
			this.loadSixType();//加载图片方法
		},
 
        methods: {
          
                loadSixType(){
	                this.$api.getCpSixType({
					    parentid:this.typeId  //图片分类ID
				            }).then(res => {
					 //处理返回数据  
					 var data = res.data;
					 this.TypeSixList = data;//得到图片集合
				})
                }
            
          }
   }

CSS

复制代码
.lbtClass{
		float: left;
		width: 100%;
		height: 60px;
	}
	.swiper-container {
	  overflow: hidden;
	  white-space: nowrap;
	}
	.swiper {
	  display: flex;
	}
	.swiper-item {
	  position: relative;
	  display: inline-block;
	  width: 30%;
	  height: 150px;
	  margin-top: 10px;
	  margin-left: 2%;
	  border-radius: 5px;
	  overflow: hidden;
	}
	.slide-image {
	  width: 100%;
	  display: block;
	}
	.Mengc{
		position: absolute;
		display: block;
		margin-top: 50%;
		float: left;
		color: #333;
		width: 100%;
		height: 15%;
		font-size: 15px;
		bottom: 0;
		left: 0;
		right: 0;
		text-align: center;
		padding-top: 3px;
		letter-spacing: 0;
		border-bottom-right-radius: 5px;
		border-bottom-left-radius: 5px;
		background-color:rgba(255, 255, 255, 0.7);
	}
相关推荐
h_65432109 小时前
微信小程序点击按钮跳转链接并显示
微信小程序·小程序
银迢迢11 小时前
微信小程序的开发及问题解决
微信小程序·小程序
liyinchi198811 小时前
原生微信小程序 textarea组件placeholder无法换行的问题解决办法
微信小程序·小程序
说私域13 小时前
基于开源链动2+1模式AI智能名片S2B2C商城小程序的低集中度市场运营策略研究
人工智能·小程序·开源·零售
少恭写代码16 小时前
duxapp 2025-03-29 更新 编译结束的复制逻辑等
react native·小程序·taro
suncentwl18 小时前
答题pk小程序道具卡的获取与应用
小程序·答题小程序·知识竞赛
bysjlwdx18 小时前
uniapp婚纱预约小程序
小程序·uni-app
ALLSectorSorft18 小时前
代驾小程序订单系统框架搭建
小程序·代驾小程序
qq_124987075318 小时前
原生小程序+springboot+vue+协同过滤算法的音乐推荐系统(源码+论文+讲解+安装+部署+调试)
java·spring boot·后端·小程序·毕业设计·课程设计·协同过滤
前端极客探险家1 天前
微信小程序全解析:从入门到实战
微信小程序·小程序