目录

1.Flex布局简介

1.1 什么是flex布局

1.2 flex属性

2.轮播图--组件的使用

3.会议OA项目-首页


1.Flex布局简介

布局的传统解决方案,基于盒状模型,依赖 display属性 + position属性 + float属性

1.1 什么是flex布局

1) Flex是Flexible Box的缩写,意为”弹性布局”,用来为盒状模型提供最大的灵活性。

2) 任何一个容器都可以指定为Flex布局。

3) display: ‘flex’

容器默认存在两根轴:水平的主轴(main axis)和垂直的交叉轴(cross axis)。主轴的开始位置(与边框的交叉点)叫做main start,结束位置叫做main end;交叉轴的开始位置叫做cross start,结束位置叫做cross end。

项目默认沿主轴排列。单个项目占据的主轴空间叫做main size,占据的交叉轴空间叫做cross size。

1.2 flex属性

  • flex-direction 主轴的方向 默认为row

  • flex-wrap 如果一条轴线排不下,如何换行

  • flex-flow 是flex-direction属性和flex-wrap属性的简写形式

  • justify-content 定义了项目在主轴上的对齐方式

  • align-items 定义项目在交叉轴上如何对齐

  • align-content 属性定义了多根轴线的对齐方式

注意,设为Flex布局以后,子元素的float、clear和vertical-align属性将失效。

学习地址:

Flex 布局语法教程 | 菜鸟教程网页布局(layout)是CSS的一个重点应用。 布局的传统解决方案,基于盒状模型,依赖 display属性 + position属性 + float属性。它对于那些特殊布局非常不方便,比如,垂直居中就不容易实现。 2009年,W3C提出了一种新的方案—-Flex布局,可以简便、完整、响应式地实现各种页面布局。目前,它已经得到了所有浏览器的支持,这意味着,现在就能很安全地使用这项功能。 Flex布局将成为未来布..http://www.runoob.com/w3cnote/flex-grammar.html

2.轮播图--组件的使用

点击在开发者工具中查看效果

选择导入即可:

拷取其中需要的代码并可进行修改:

index.wxml:

<view><swiper autoplay="true" indicator-dots="true" indicator-color="#fff" indicator-active-color="#00f"><block wx:for="{{imgSrcs}}" wx:key="text"><swiper-item><view><image src="{{item.img}}" class="swiper-item" /></view></swiper-item></block></swiper>
</view>

在没有后台的情况下会使用mokcjs:

新建一个接口:

json数据包:

{"data": {"images":[{"img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner1.png","text": "1"},{"img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner2.png","text": "2"},{"img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner3.png","text": "3"},{"img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner4.png","text": "4"},{"img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner5.png","text": "5"},{"img": "https://cdn-we-retail.ym.tencent.com/tsr/home/v2/banner6.png","text": "6"}
]},"statusCode": "200","header": {"content-type":"applicaiton/json;charset=utf-8"}
}

index/index.js界面

// pages/index/index.js
const api = require("../../config/app")
Page({/*** 页面的初始数据*/data: {imgSrcs:[]//需要调用:http://localhost:8080/demo/wx/swiperImgs接口地主数据},/*** 生命周期函数--监听页面加载*/onLoad(options) {this.loadSwiperImgs();},/*** 生命周期函数--监听页面初次渲染完成*/onReady() {},/*** 生命周期函数--监听页面显示*/onShow() {},/*** 生命周期函数--监听页面隐藏*/onHide() {},/*** 生命周期函数--监听页面卸载*/onUnload() {},/*** 页面相关事件处理函数--监听用户下拉动作*/onPullDownRefresh() {},/*** 页面上拉触底事件的处理函数*/onReachBottom() {},/*** 用户点击右上角分享*/onShareAppMessage() {},loadSwiperImgs(){let that=this;wx.request({url: api.SwiperImgs,dataType: 'json',success(res) {console.log(res)that.setData({imgSrcs:res.data.images})}})}
})

轮播图效果:

3.会议OA项目-首页

"list": [{"pagePath": "pages/index/index","text": "首页","iconPath": "/static/tabBar/coding.png","selectedIconPath": "/static/tabBar/coding-active.png"},{"pagePath": "pages/meeting/list/list","iconPath": "/static/tabBar/sdk.png","selectedIconPath": "/static/tabBar/sdk-active.png","text": "会议"},{"pagePath": "pages/vote/list/list","iconPath": "/static/tabBar/template.png","selectedIconPath": "/static/tabBar/template-active.png","text": "投票"},{"pagePath": "pages/ucenter/index/index","iconPath": "/static/tabBar/component.png","selectedIconPath": "/static/tabBar/component-active.png","text": "设置"}]

copy入static文件:

static文件:

persons文件:

tabBar文件:

看一下基础的布局:

弹性布局:不会随着屏幕变化而使画面失帧

<!--pages/vote/list/list.wxml-->
<!-- <text>pages/vote/list/list.wxml</text> -->
<view class="box"><view>1</view><view>2</view><view>3</view><view>4</view><view>5</view><view>6</view><view>7</view>
</view>

/* pages/vote/list/list.wxss */
.box{height: 750rpx;width: 750rpx;background-color: aqua;display: flex;
}
view{height: 100rpx;width: 100rpx;border: 1px solid rebeccapurple;
}

效果:

/* pages/vote/list/list.wxss */
.box{height: 750rpx;width: 750rpx;background-color: aqua;display: flex;flex-direction: column-reverse;/*竖型排列*/
}
view{height: 100rpx;width: 100rpx;border: 1px solid rebeccapurple;
}

效果:

其余的效果可以在官网中查找:

会议信息:

index.js:

// pages/index/index.js
const api = require("../../config/app")
Page({/*** 页面的初始数据*/data: {imgSrcs:[],//需要调用:http://localhost:8080/demo/wx/swiperImgs接口地主数据lists:[{"id": "1","image": "/static/persons/1.jpg","title": "对话产品总监 | 深圳·北京PM大会 【深度对话小米/京东/等产品总监】","num":"304","state":"进行中","starttime": "2022-03-13 00:00:00","location": "深圳市·南山区"},{"id": "1","image": "/static/persons/2.jpg","title": "AI WORLD 2016世界人工智能大会","num":"380","state":"已结束","starttime": "2022-03-15 00:00:00","location": "北京市·朝阳区"},{"id": "1","image": "/static/persons/3.jpg","title": "H100太空商业大会","num":"500","state":"进行中","starttime": "2022-03-13 00:00:00","location": "大连市"},{"id": "1","image": "/static/persons/4.jpg","title": "报名年度盛事,大咖云集!2016凤凰国际论坛邀您“与世界对话”","num":"150","state":"已结束","starttime": "2022-03-13 00:00:00","location": "北京市·朝阳区"},{"id": "1","image": "/static/persons/5.jpg","title": "新质生活 · 品质时代 2016消费升级创新大会","num":"217","state":"进行中","starttime": "2022-03-13 00:00:00","location": "北京市·朝阳区"}]},/*** 生命周期函数--监听页面加载*/onLoad(options) {this.loadSwiperImgs();},/*** 生命周期函数--监听页面初次渲染完成*/onReady() {},/*** 生命周期函数--监听页面显示*/onShow() {},/*** 生命周期函数--监听页面隐藏*/onHide() {},/*** 生命周期函数--监听页面卸载*/onUnload() {},/*** 页面相关事件处理函数--监听用户下拉动作*/onPullDownRefresh() {},/*** 页面上拉触底事件的处理函数*/onReachBottom() {},/*** 用户点击右上角分享*/onShareAppMessage() {},loadSwiperImgs(){let that=this;wx.request({url: api.SwiperImgs,dataType: 'json',success(res) {console.log(res)that.setData({imgSrcs:res.data.images})}})}
})

index.wxml:

<!--pages/index/index.wxml-->
<!-- <text>pages/index/index.wxml</text> -->
<view><swiper autoplay="true" indicator-dots="true" indicator-color="#fff" indicator-active-color="#00f"><block wx:for="{{imgSrcs}}" wx:key="text"><swiper-item><view><image src="{{item.img}}" class="swiper-item" /></view></swiper-item></block></swiper>
</view>
<view class="mobi-title"><text class="mobi-icon"></text><text>会议信息</text>
</view>
<block wx:for-items="{{lists}}" wx:for-item="item" wx:key="item.id"><view class="list" data-id="{{item.id}}"><view class="list-img"><image class="video-img" mode="scaleToFill" src="{{item.image}}"></image></view><view class="list-detail"><view class="list-title"><text>{{item.title}}</text></view><view class="list-tag"><view class="state">{{item.state}}</view><view class="join"><text class="list-num">{{item.num}}</text>人报名</view></view><view class="list-info"><text>{{item.location}}</text>|<text>{{item.starttime}}</text></view></view></view>
</block>
<view class="section bottom-line"><text>到底啦</text>
</view>

index.wxss:

.mobi-title {font-size: 12pt;color: #777;line-height: 110%;font-weight: bold;width: 100%;padding: 15rpx;background-color: #f3f3f3;
}.mobi-icon {padding: 0rpx 3rpx;border-radius: 3rpx;background-color: #ff7777;position: relative;margin-right: 10rpx;
}/*list*/
.list {display: flex;flex-direction: row;width: 100%;padding: 0 20rpx 0 0;border-top: 1px solid #eeeeee;background-color: #fff;margin-bottom: 5rpx;/* border-radius: 20rpx;box-shadow: 0px 0px 10px 6px rgba(0,0,0,0.1); */
}.list-img {display: flex;margin: 10rpx 10rpx;width: 150rpx;height: 220rpx;justify-content: center;align-items: center;
}.list-img .video-img {width: 120rpx;height: 120rpx;}.list-detail {margin: 10rpx 10rpx;display: flex;flex-direction: column;width: 600rpx;height: 220rpx;
}.list-title text {font-size: 11pt;color: #333;font-weight: bold;
}.list-detail .list-tag {display: flex;height: 70rpx;
}.list-tag .state {font-size: 9pt;color: #81aaf7;width: 120rpx;border: 1px solid #93b9ff;border-radius: 2px;margin: 10rpx 0rpx;display: flex;justify-content: center;align-items: center;
}.list-tag .join {font-size: 11pt;color: #bbb;margin-left: 20rpx;display: flex;justify-content: center;align-items: center;
}.list-tag .list-num {font-size: 11pt;color: #ff6666;
}.list-info {font-size: 9pt;color: #bbb;margin-top: 20rpx;
}
.bottom-line{display: flex;height: 60rpx;justify-content: center;align-items: center;background-color: #f3f3f3;
}
.bottom-line text{font-size: 9pt;color: #666;
}

效果展示:

微信小程序-会议OA项目03相关推荐

  1. 微信小程序练手项目-音乐播放器

    微信小程序练手项目-音乐播放器 该项目只适合练手,大佬请绕道 项目展示图: 项目介绍 微信小程序音乐播放器 页面: 音乐推荐.播放器.播放列表 功能: 播放.暂停.上一首.下一首.跳转播放列表.实时进 ...

  2. 详解微信小程序开发(项目从零开始)

    关注公众号 风色年代(itfantasycc) 280G前端&小程序资料随便拿! 详解微信小程序开发(项目从零开始) 一.序 微信小程序,估计大家都不陌生,现在应用场景特别多.今天就系统的介绍 ...

  3. 微信读书登陆界面java_(JAVA后端)微信小程序-毕设级项目搭建-微信阅读小程序(内含源码,微信小程序+java逻辑后台+vue管理系统)~不求完美,实现就好...

    转载地址:(JAVA后端)微信小程序-毕设级项目搭建-微信阅读小程序(内含源码,微信小程序+java逻辑后台+vue管理系统)~不求完美,实现就好 转载请注明出处 一.环境搭建 相关环境软件:JDK1 ...

  4. 微信小程序云开发项目-个人待办事项-02今日模块开发

    上一篇: 微信小程序云开发项目-个人待办事项-01介绍 https://blog.csdn.net/IndexMan/article/details/124485626 模块开发步骤 本篇介绍今日模块 ...

  5. 微信小程序云音乐项目

    微信小程序云音乐项目 微信小程序云音乐项目 1. 项目介绍 技术栈 项目使用库 项目目标 2. 页面效果和功能展示 3. 项目源码与 API 接口 4. 项目说明 5. 致谢 微信小程序云音乐项目 1 ...

  6. 微信小程序电商项目开发实战漫谈

    原创文章,若转载请于明显处标明出处和相关链接:https://www.toutiao.com/i6567868839856439822/,否则追究其法律责任! 2018年小程序内容电商风口已成,如果我 ...

  7. 微信小程序电商项目商品详情页开发实战之数据绑定与事件应用

    各位CSDN的朋友,我们都知道,现在微信小程序电商平台特别火爆,所以我将以一个生鲜电商项目为例,为大家讲述微信小程序的实战化开发,价值几万元的成熟项目,你可千万不要错过哦. 大家直接通过视频链接直接看 ...

  8. 微信小程序电商项目实战-前言

    各位CSDN的朋友,我们都知道,现在微信小程序电商平台特别火爆,所以我将以一个生鲜电商项目为例,为大家讲述微信小程序的实战化开发,价值几万元的成熟项目,你可千万不要错过哦. 大家直接通过视频链接直接看 ...

  9. 微信小程序电商项目源代码开放连载二三事

    大家好,我发布的微信小程序电商项目连载视频,正式进入实战化阶段了,为了让大家更好的去学习微信小程序开发,我在gitbub上面,开放了源代码.随着视频的连载更新,我会逐步将源代码进行更新. 源代码发布地 ...

最新文章

  1. 谷歌下一代AI架构、Jeff Dean宣传大半年的Pathways终于有论文了
  2. python3爬虫系列教程-Python3爬虫视频学习教程
  3. oracle net manager没有orcl_Oracle-数据库基础知识
  4. SQL的3个主要组成
  5. 狗窝里的小日子 ...
  6. Ubuntu安装VMware Workstation详解
  7. TypeScript入门教程 之 Let 关键字
  8. Java NIO AIO编程
  9. 华为鸿蒙系统是物联网,华为鸿蒙系统官宣!谷歌工程师直接懵了,硅谷感慨:中国人太厉害...
  10. 不出现php version网页_谈谈 PHP 的自动加载机制与 Laravel 中的具体实现
  11. 一个线上SQL死锁异常分析:深入了解事务和锁
  12. 微软自动化测试工具Playwright快速上手指南
  13. DisplayTag1.2
  14. python爬虫爬取网站视频_python3爬虫爬取视频(一)
  15. 互联网日报 | 2月8日 星期一 | 乐视回应App图标“欠122亿”;中国联通成立联通数科;高德地图上线13万个旅游厕所信息...
  16. python ui自动化面试题_UI自动化面试题
  17. php随机一句话,PHP简单实现一言 / 随机一句功能
  18. error: ‘ULONG_MAX’ was not declared in this scope
  19. #1353 : 满减优惠(01背包变形)
  20. 多媒体封装格式详解---MP4

热门文章

  1. 碉堡了!程序员用深度学习写了个老板探测器(附源码)
  2. 中国开源项目贡献者已超过10万,《中国开源生态图谱 2023》发布
  3. 2021年焊工(初级)找解析及焊工(初级)模拟考试题库
  4. Struts2 最新高危漏洞详解
  5. s8 能刷android p吗,国行三星S8迎重大更新:手机终于能刷卡了
  6. SQL server服务器类型
  7. Linux 运维面试题20道
  8. 换掉 UUID,更快更安全!
  9. mc服务器怎么传送到我位置,我的世界手机版怎么传送到坐标
  10. C++中std::allocator的使用