博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
小程序开发基础-view视图容器
阅读量:4322 次
发布时间:2019-06-06

本文共 4912 字,大约阅读时间需要 16 分钟。

标题图

view

视图容器。

// wxml
flex-direction: row
1
2
3
// wxss.flex-wrp_one{  display: flex;  flex-direction: row;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

图片

// wxml
flex-direction: column
1
2
3
// wxss.flex-wrp_two{  display: flex;  flex-direction: column;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

图片

// wxml
justify-content: flex-start
1
2
3
// wxss .flex-wrp_three{  display: flex;  justify-content: flex-start;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

view

// wxml
justify-content: flex-end
1
2
3
// wxss.flex-wrp_four{  display: flex;  justify-content: flex-end;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

view

// wxml
justify-content: center
1
2
3
// wxss.flex-wrp_five{  display: flex;  justify-content: center;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

view

// wxml
justify-content: space-between
1
2
3
// wxss.flex-wrp_six{  display: flex;  justify-content: space-between;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

view

// wxml
justify-content: space-around
1
2
3
// wxss.flex-wrp_seven{  display: flex;  justify-content: space-around;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

view

// wxml
justify-content: space-evenly
1
2
3
// wxss.flex-wrp_eight{  display: flex;  justify-content: space-evenly;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

view

属性

排列方式(flex-direction) 描述
row 横向排列
column 纵向排列
项目内容对齐(justify-content) 描述
flex-start 向行头紧挨
flex-end 向行尾紧挨
center 居中紧挨
space-between 平均分布
space-around 平均分布 ,两边留有一半间隔
space-evenly 两边间隔与中间相同

源码

// wxml
flex-direction: row
1
2
3
flex-direction: column
1
2
3
justify-content: flex-start
1
2
3
justify-content: flex-end
1
2
3
justify-content: center
1
2
3
justify-content: space-between
1
2
3
justify-content: space-around
1
2
3
justify-content: space-evenly
1
2
3
// wxss.flex-wrp_one{  display: flex;  flex-direction: row;}.flex-wrp_two{  display: flex;  flex-direction: column;}.flex-wrp_three{  display: flex;  justify-content: flex-start;}.flex-wrp_four{  display: flex;  justify-content: flex-end;}.flex-wrp_five{  display: flex;  justify-content: center;}.flex-wrp_six{  display: flex;  justify-content: space-between;}.flex-wrp_seven{  display: flex;  justify-content: space-around;}.flex-wrp_eight{  display: flex;  justify-content: space-evenly;}.flex-item{  width: 100px;  height: 100px;}.bc_green{  background: green;}.bc_red{  background: red;}.bc_blue{  background: blue;}

开源github分享

微信小程序分享?
Github 欢迎 Star、Fork

结语

  • 本文主要讲解 小程序开发基础-view视图容器
  • 下面我将继续对其他知识 深入讲解 ,有兴趣可以继续关注
  • 小礼物走一走 or 点赞

送❤

转载于:https://www.cnblogs.com/dashucoding/p/9493374.html

你可能感兴趣的文章
初识ionic
查看>>
java 中打印调用栈
查看>>
开发 笔记
查看>>
数据挖掘算法比赛 - 简单经验总结
查看>>
win7(64位)php5.5-Apache2.4-mysql5.6环境安装
查看>>
生成商户订单号/退款单号
查看>>
使用Android OpenGL ES 2.0绘图之六:响应触摸事件
查看>>
我们过去几年做对了哪些事
查看>>
ubuntu 16.04LTS
查看>>
javascript深入理解js闭包
查看>>
Oracle的安装
查看>>
Android Socket连接PC出错问题及解决
查看>>
Android Studio-—使用OpenCV的配置方法和demo以及开发过程中遇到的问题解决
查看>>
第2天线性表链式存储
查看>>
python自动化测试-D11-学习笔记之一(yaml文件,ddt)
查看>>
mysql存储过程使用游标循环插入数据
查看>>
Ubuntu 12.04 添加新用户并启用root登录
查看>>
shell中$0,$?,$!等的特殊用法
查看>>
20145309信息安全系统设计基础第9周学习总结上
查看>>
c# 字段、属性get set
查看>>