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

效果图

参考微信小程序可看

代码:

复制代码
<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);
	}
相关推荐
百锦再20 分钟前
Elements Plus 跨设备自适应显示问题综合解决方案
python·flutter·小程序·uni-app·k8s·tornado·net
毕设源码-邱学长2 小时前
【开题答辩全过程】以 基于微信小程序的实验耗材申报平台的设计与实现为例,包含答辩的问题和答案
微信小程序·小程序
说私域2 小时前
基于开源AI智能名片链动2+1模式商城系统的创始人个人品牌资产构建研究
人工智能·小程序·开源
sheji34162 小时前
【开题答辩全过程】以 基于微信小程序的手机数码交易平台为例,包含答辩的问题和答案
微信小程序·小程序
计算机徐师兄2 小时前
Java基于微信小程序的社区养老保障系统
java·微信小程序·社区养老保障系统小程序·java社区养老保障系统小程序·社区养老保障系统微信小程序·社区养老保障微信小程序
项目題供诗3 小时前
微信小程序黑马优购(项目)(十二)
微信小程序·小程序
luffy54593 小时前
微信小程序组件与父页面传值示例
微信小程序·小程序
百锦再17 小时前
抖音小程序开发全景透视:生态解析、技术架构与商业实践
人工智能·ai·微信小程序·小程序·架构·模型·抖音
低代码布道师21 小时前
互联网医院18:前端进阶——CSS“父相子绝”打造专业级卡片交互
前端·css·低代码·小程序·云开发
说私域1 天前
开源活动报名AI智能客服AI智能名片预约服务小程序在精神服务中的应用场景研究
人工智能·小程序