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

效果图

参考微信小程序可看

代码:

复制代码
<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);
	}
相关推荐
计算机学姐12 小时前
基于微信小程序的图书馆座位预约系统【uniapp+springboot+vue】
vue.js·spring boot·微信小程序·小程序·java-ee·uni-app·intellij-idea
焦糖玛奇朵婷17 小时前
健身房预约小程序开发、设计
java·大数据·服务器·前端·小程序
Dragon Wu18 小时前
Taro v4.2.0 scss使用“@/xxx“的配置方法
前端·小程序·taro·scss
WKK_18 小时前
uniapp 微信小程序使用TextEncoder,arrayBufferToBase64
微信小程序·小程序·uni-app
舟遥遥娓飘飘20 小时前
面向零基础初学者,从环境搭建到发布上线,手把手教你开发第一个微信小程序(第3章-认识项目结构)
微信小程序·小程序·notepad++
优睿远行21 小时前
微信小程序自定义组件开发实战:从封装到发布的全流程指南
微信小程序·小程序·notepad++
276695829221 小时前
某白山小程序限制PC端调试
python·小程序·apache·小程序逆向·某白山·限制pc调试
Greg_Zhong1 天前
微信小程序中使用云函数调用豆包免费模型,部署云函数设置(触发器)执行每日自动生成书籍的文章赏析,完整过程
微信小程序·ai工程师·小程序中豆包模型调用·云函数配置触发器生成每日文章·微信云函数
eric*16881 天前
微信小程序全局安全水印组件实践:支持动态更新、全局生效、自定义样式
微信小程序·小程序
Geek_Vison1 天前
三款小程序容器技术选型对比分析——融媒新闻APP如何进行技术选型~
小程序·uni-app·app开发·finclip·小程序开发平台·跨端开发·小程序容器