微信小程序首页、界面布局、功能简洁(示例三)

微信小程序首页界面布局、页面简洁,功能简单

首页简洁布局示例
直接上具体代码:
1、js代码

Page({/*** 页面的初始数据*/data: {imgList: ['../../images/demo.jpg', '../../images/demo.jpg', '../../images/demo.jpg'],navList: [{'src': '../../images/nav1.png','title': '菜单一'},{'src': '../../images/nav2.png','title': '菜单二'},{'src': '../../images/nav3.png','title': '菜单三'},{'src': '../../images/nav4.png','title': '菜单四'},],dataList: [{'coverUrl': '../../images/demo.jpg','label': '推荐','title': '纯属示例数据呦~','date': '2023年1月23日','brand': '点赞','price': '2.98'},{'coverUrl': '../../images/demo.jpg','label': '经典','title': '点赞收藏加关注,下次还能找到呦~','date': '2023年1月23日','brand': '收藏','price': '1.98'},{'coverUrl': '../../images/demo.jpg','label': '模板','title': '不定期发布各种示例模板,进我主页,查看更多示例内容呦~','date': '2023年1月23日','brand': '关注','price': '0.98'},]},// 菜单navClick(e) {wx.showToast({title: '您点击了【' + e.currentTarget.dataset.item.title + '】',})},// 详情detailClick(e) {wx.showToast({title: e.currentTarget.dataset.item.title,})},
})

2、wxml代码

<!-- 轮播图 -->
<swiper class="margin" indicator-dots="true" autoplay="true" interval="2000" duration="500" indicator-color="gray" indicator-active-color="white"><block wx:for="{{imgList}}" wx:for-index="index" wx:for-item="item" wx:key="item"><swiper-item><image src="{{item}}" mode="widthFix"></image></swiper-item></block>
</swiper>
<!-- 菜单栏 -->
<view class="nav-box"><block wx:for="{{navList}}" wx:for-index="index" wx:for-item="item" wx:key="item"><view class="nav" bind:tap="navClick" data-item="{{item}}"><image src="{{item.src}}" mode="widthFix"></image><text>{{item.title}}</text></view></block>
</view>
<!-- 列表数据 -->
<view class="box"><view class="list-title">示例数据</view><scroll-view scroll-y="true" show-scrollbar="{{false}}" enhanced="{{true}}"><block wx:for="{{dataList}}" wx:for-index="index" wx:for-item="item" wx:key="item"><view class="level row" bind:tap="detailClick" data-item="{{item}}"><view class="left-img"><image src="{{item.coverUrl}}"></image></view><view class="right-info"><view><view class="right-title"><text class="car-dot">{{item.label}}</text>{{item.title}}</view><view class="right-gray">{{item.date}}</view></view><view class="level right-bot"><view>{{item.brand}}</view><view>{{item.price}} 元</view></view></view></view></block><view class="no-more">我是有底线的呦~</view></scroll-view>
</view>

3、wxss代码

page {background-color: #f1f1f1;
}/* 轮播图 */
.margin {margin: 20rpx;
}swiper-item {border-radius: 20rpx;
}swiper-item image {width: 100%;
}/* 菜单栏 */
.nav-box {display: flex;flex-direction: row;align-items: center;margin: 20rpx 0;
}.nav {display: flex;flex-direction: column;align-items: center;flex: 1;
}.nav image {width: 40%;background-color: white;border-radius: 20rpx;padding: 15rpx;
}.nav text {margin-top: 15rpx;font-size: 30rpx;
}/* 列表信息 */
.box {margin: 20rpx;
}.list-title {margin: 0 10rpx;font-size: 30rpx;font-weight: bold;
}.level {display: flex;flex-direction: row;
}.row {margin-top: 20rpx;background-color: #fff;padding: 10rpx;border-radius: 10rpx;min-height: 200rpx;
}.left-img {width: 45%;
}.left-img image {width: 100%;border-radius: 5rpx;max-height: 200rpx;
}.right-info {width: 55%;display: flex;padding-left: 15rpx;flex-direction: column;justify-content: space-between;
}.right-title {font-size: 30rpx;display: -webkit-box;word-break: break-all;text-overflow: ellipsis;overflow: hidden;-webkit-box-orient: vertical;-webkit-line-clamp: 2;
}.right-gray {font-size: 28rpx;color: #909399;margin-top: 5rpx;display: -webkit-box;word-break: break-all;text-overflow: ellipsis;overflow: hidden;-webkit-box-orient: vertical;-webkit-line-clamp: 1;
}.car-dot {font-size: 20rpx;background-color: #f29100;margin-right: 10rpx;padding: 2rpx 5rpx;color: white;
}.right-bot {align-items: center;justify-content: space-between;
}.right-bot view:nth-child(1) {font-size: 28rpx;
}.right-bot view:nth-child(2) {color: #fa3534;font-size: 30rpx;font-weight: bold;
}.no-more {text-align: center;padding: 20rpx 0;font-size: 26rpx;color: #909399;
}

4、json代码

{"usingComponents": {},"navigationBarTitleText": "首页简洁布局示例"
}

界面中包含的图片地址可自行修改。页面布局简洁,功能简单,没有写具体的监听事件,只是简单的将监听进行了绑定,如需要具体的监听功能事件,需要根据自己的需求进行修改呦,如需更多示例,进我主页呦~,如需没有合适的demo,请留言,有空就发。写的不好,请多包涵。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/427527.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

鸿蒙开发系列教程(八)--ArkTS语言:IF-ELSE渲染

条件渲染 if/else Entry Component struct ViewA1 {State count: number 0;build() {Column() {Text(计数${this.count})if (this.count 5) {Text(数字等于5).fontColor(Color.Green)} else {Text(数字不等于5).fontColor(Color.Red)}Button(增加).onClick(() > {this.cou…

理想汽车大模型算法工程师面试,被问的瑟瑟发抖。。。。

最近我们技术群的一位小伙伴&#xff0c;分享了他面试理想汽车大模型算法工程师的经历与经验。 今天整理后分享给大家&#xff0c;如果你对这块感兴趣&#xff0c;可以文末加入我们的技术&面试讨论群 一面&#xff08;1.5h&#xff0c;感觉有点难&#xff09; 自我介绍&…

CPU中的算术逻辑单元(ALU)

ALU有2个单元&#xff0c;1个算术单元和1个逻辑单元 算数单元 1 bit加法 半加器 由一个异或门&#xff08;XOR&#xff09;和与门&#xff08;AND&#xff09;两个逻辑门构成&#xff0c;异或门表示无进位加法&#xff08;sum&#xff09;&#xff0c;而与门表示进位&…

解决 Git:ssh: connect to host github.com port 22: Connection timed out 问题的三种方案

1、问题描述&#xff1a; 其一、整体提示为&#xff1a; ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository. 中文为&#xff1a; ssh&#xff1a;连接到主机 github.com 端口 22&#xff1a;连接超时 fatal&a…

在IntelliJ IDEA中通过Spring Boot集成达梦数据库:从入门到精通

目录 博客前言 一.创建springboot项目 新建项目 选择创建类型​编辑 测试 二.集成达梦数据库 添加达梦数据库部分依赖 添加数据库驱动包 配置数据库连接信息 编写测试代码 验证连接是否成功 博客前言 随着数字化时代的到来&#xff0c;数据库在应用程序中的地位越来…

在Go中处理HTTP请求和响应

在Go语言中&#xff0c;处理HTTP请求和响应的关键在于对net/http包的理解和使用。这个包提供了强大的工具&#xff0c;使开发者能够轻松地构建Web应用程序。以下是一个简单的示例&#xff0c;展示了如何在Go中处理HTTP请求和响应。 首先&#xff0c;确保你已经安装了Go语言的开…

spring Cloud Stream 实战应用深度讲解

springCloudStream 简介 Spring Cloud Stream是一个框架&#xff0c;用于构建与共享消息传递系统连接的高度可扩展的事件驱动微服务。 该框架提供了一个灵活的编程模型&#xff0c;该模型建立在已经建立和熟悉的 Spring 习惯用语和最佳实践之上&#xff0c;包括对持久发布/订…

springboot家乡特色推荐系统源码和论文

在Internet高速发展的今天&#xff0c;我们生活的各个领域都涉及到计算机的应用&#xff0c;其中包括家乡特色推荐的网络应用&#xff0c;在外国家乡特色推荐系统已经是很普遍的方式&#xff0c;不过国内的管理网站可能还处于起步阶段。家乡特色推荐系统采用java技术&#xff0…

python数据和分析——pandas基础内容

Pandas 的两个主要的数据结构是 Series 和 DataFrame&#xff1a; Series 是一维标记数组&#xff0c;类似于带有标签的列表。它可以包含不同类型的数据&#xff0c;并且可以通过索引进行访问和操作。DataFrame 是二维表格型数据结构&#xff0c;类似于 SQL 表或 Excel 电子表…

Apipost自动化测试+Jenkins实现持续集成

Apipost 自动化测试支持「持续集成」功能&#xff0c;在安装了Apipost的服务器中输入命令&#xff0c;即可运行测试脚本。 创建自动化测试脚本 在创建好的测试用例中选择「持续集成」。 点击新建&#xff0c;配置运行环境、循环次数、间隔停顿后点击保存会生成命令。 安装 Ap…

Python列表与元组

Python 列表和元组是Python编程语言中两种重要的数据结构&#xff0c;它们在实际的编程中扮演着不可或缺的角色。本文将深入探讨Python列表和元组的特性、用法以及它们之间的区别&#xff0c;帮助读者更好地理解和运用这两种数据结构。 Python 列表 Python 列表是一种有序、可…

小土堆pytorch学习笔记001

1、Pytorch环境的配置与安装。 &#xff08;1&#xff09;建议安装&#xff1a;Anaconda &#xff08;2&#xff09;检查显卡&#xff1a;GPU &#xff08;3&#xff09;管理环境&#xff08;不同版本的pytorch 版本不同&#xff09;&#xff1a; conda create -n pytorch…