当前位置: 首页 > news >正文

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

效果图

参考微信小程序可看

 

代码:

<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);}

 

http://www.lryc.cn/news/382275.html

相关文章:

  • 无人机巡检小羊仿真
  • springboot redission 分布式锁
  • Vuex中的重要核心属性
  • Redis哨兵集群搭建
  • 网络爬虫requests库使用指南
  • VSCODE 配置C++ 与OPENCV
  • C语言小例程28/100
  • WPF文本绑定显示格式StringFormat设置-特殊格式时间日期和多数据绑定
  • Java包介绍
  • 【2024.6.21】今日科技时事:科技前沿大事件
  • LeetCode:经典题之1491、896 题解与延伸
  • 2024三掌柜赠书活动第二十五期:Rust 游戏开发实战
  • 基于Java蛋糕甜品商城系统设计和实现(源码+LW+调试文档+讲解等)
  • Tomcat get请求传数组集合参数
  • 信息学奥赛初赛天天练-34-CSP-J2021完善程序-按位异或、模拟算法、数组模拟环、约瑟夫问题应用
  • 【计算机视觉】人脸算法之图像处理基础知识(六)
  • 仓颉编程语言入门
  • 在前端项目中,如何处理错误和异常?
  • Ubuntu系统下修改网卡IP地址
  • Scrapy如何对爬虫数据进行清洗和处理?
  • Linux:基础IO(三.软硬链接、动态库和静态库、动精态库的制作和加载)
  • 低价可转债崩盘,发生了什么?
  • 【面试题】马上金九银十了,简历该准备起来了,面试题你准备好了吗 ?浅谈 JS 浅拷贝和深拷贝
  • 最新OPPO 真我手机 一加手机 使用adb命令永久关闭系统更新教程
  • OnlyOffice:现代办公的最佳选择
  • 【收藏】2024年必备相图数据库资源集锦!
  • Zookeeper 二、Zookeeper环境搭建
  • Web3 学习
  • Grafana+Prometheus(InfluxDB)+Jmeter使用Nginx代理搭建可视化性能测试监控平台
  • web学习笔记(六十六)项目总结