view

视图容器。

// wxml
<view class="section">
<view class="section__title">flex-direction: row</view>
<view class="flex-wrp_one">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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
<view class="section">
<view class="section__title">flex-direction: column</view>
<view class="flex-wrp_two">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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
<view class="section">
<view class="section__title">justify-content: flex-start</view>
<view class="flex-wrp_three">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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;
}

// wxml
<view class="section">
<view class="section__title">justify-content: flex-end</view>
<view class="flex-wrp_four">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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;
}

// wxml
<view class="section">
<view class="section__title">justify-content: center</view>
<view class="flex-wrp_five">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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;
}

// wxml
<view class="section">
<view class="section__title">justify-content: space-between</view>
<view class="flex-wrp_six">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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;
}

// wxml
<view class="section">
<view class="section__title">justify-content: space-around</view>
<view class="flex-wrp_seven">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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;
}

// wxml
<view class="section">
<view class="section__title">justify-content: space-evenly</view>
<view class="flex-wrp_eight">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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;
}

属性

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

源码

// wxml
<view class="section">
<view class="section__title">flex-direction: row</view>
<view class="flex-wrp_one">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view> <view class="section">
<view class="section__title">flex-direction: column</view>
<view class="flex-wrp_two">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view> <view class="section">
<view class="section__title">justify-content: flex-start</view>
<view class="flex-wrp_three">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view> <view class="section">
<view class="section__title">justify-content: flex-end</view>
<view class="flex-wrp_four">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view> <view class="section">
<view class="section__title">justify-content: center</view>
<view class="flex-wrp_five">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view> <view class="section">
<view class="section__title">justify-content: space-between</view>
<view class="flex-wrp_six">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view> <view class="section">
<view class="section__title">justify-content: space-around</view>
<view class="flex-wrp_seven">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view> <view class="section">
<view class="section__title">justify-content: space-evenly</view>
<view class="flex-wrp_eight">
<view class="flex-item bc_green">1</view>
<view class="flex-item bc_red">2</view>
<view class="flex-item bc_blue">3</view>
</view>
</view>
// 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分享

Wechat_small_program_Share

微信小程序分享

小程序开发基础-view视图容器的更多相关文章

  1. 微信小程序_(组件)view视图容器

    微信小程序view组件官方文档 传送门 Learn 一.hover-class属性 二.hover-start-time与hover-stay-time属性 三.hover-stop-propagat ...

  2. 小程序开发基础-swiper 滑块视图容器

    小编 / 达叔小生 参考官方文档:https://developers.weixin.qq.com/miniprogram/dev/component/ 小程序开发基础-swiper 滑块视图容器 根 ...

  3. 小程序开发基础-scroll-view 可滚动视图区域

    小编 / 达叔小生 小程序开发基础-scroll-view 可滚动视图区域 这里只展示纵向滚动,横向同理就不用说明了,可自己尝试,横向滚动属性为scroll-x,把纵向滚动改为横向滚动即可. scro ...

  4. 微信小程序开发基础

    前言: 微信小程序开入入门,如果你有html+css+javascript的基础,那么你就很快地上手掌握的.下面提供微信小程序官方地址:https://developers.weixin.qq.com ...

  5. 小程序开发-基础组件icon/text/progress入门

    小程序的基础组件--基础内容 基础内容分为三大组件: 1. icon--图标 index.wxml <view class="group"> <block wx: ...

  6. 微信小程序开发基础知识总结

    微信小程序在无论在功能.文档及相关支持方面,都是优于前面几种微信账号类型,它提供了很多原生程序才有的接口,使得我们的小程序在很多方面突破H5页面应用的限制,更加接近原生程序的功能,因此微信小程序具有很 ...

  7. 微信小程序开发——后端Java(一)

    一.前言 最近接触了小程序的开发,后端选择Java,因为小程序的代码运行在腾讯的服务器上,而我们自己编写的Java代码运行在我们自己部署的服务器上,所以一开始不是很明白小程序如何与后台进行通信的,然后 ...

  8. 微信小程序开发 -- 01

    微信小程序开发基础 -- 开发前的准备 缘由 1月9日张小龙微信小程序正式上线,因为微信,所以小程序从诞生开始就头戴巨大的光环,很多的团队,公司以及开发的个体都眼巴巴的盯着这个小程序.而那个时候我却在 ...

  9. 零基础入门微信小程序开发

    注:本文来源于:<零基础入门微信小程序开发> 课程介绍 本达人课是一个系列入门教程,目标是从 0 开始带领读者上手实战,课程以微信小程序的核心概念作为主线,介绍配置文件.页面样式文件.Ja ...

随机推荐

  1. c# 多种方法调整屏幕亮度

    Github: https://github.com/CHNMaxGor/AjustScreenBrightness 方法一: 使用网上常说的 Gdi32.dll 下的 SetDeviceGammaR ...

  2. 5.App Inventor 2编程实例--指南针

    本视频来自:https://www.17coding.net 的  国庆特辑——指南针 共3个视频. 注意: 项目名字要使用英文. 项目完成后可以选择“打包APK”—“ 打包APK并下载到电脑”,然后 ...

  3. PyCharm 如何远程连接服务器编写程序

    写在前面 我之前一直通过mstsc远程服务器桌面修改代码,或者本地修改后上传到远程服务器等,各种不爽,现在改用xshell,但有时候还是感觉不方便.于是乎,自己动手配置PyCharm远程连接服务器,这 ...

  4. Java中String做为synchronized同步锁使用详解

    Java中使用String作同步锁 在Java中String是一种特殊的类型存在,在jdk中String在创建后是共享常量池的,即使在jdk1.8之后实现有所不同,但是功能还是差不多的. 借助这个特点 ...

  5. 微信公众平台网页登录授权多次重定向跳转,导致code使用多次问题

    背景:微信网站开发 昨天我负责的一个项目忽然出现了一个十分诡异的bug,进行微信授权登录的时候请求code的时候安卓手机会多次重定向调转我的接口接收code的接口(redirect_uri 微信请求调 ...

  6. Linux运维老司机:CentOS6.9配置安装并配置Rsync

    一.rsync简介 rsync全称remote sync,是一种更高效.可以本地或远程同步的命令,之所以高效是因为rsync会对需要同步的源和目的进度行对比,只同步有改变的部分,所以比scp命令更高效 ...

  7. 使用 shell / python 进行sql的excel报表导出

    如果要求你进行一个表数据的导出,如果使用shell的话,很容易做到,即执行一下 select 语句就可以拿到返回结果了! 如下: /usr/bin/mysql -u"${username}& ...

  8. ASP.NET Core中使用GraphQL - 第六章 使用EF Core作为持久化仓储

    ASP.NET Core中使用GraphQL ASP.NET Core中使用GraphQL - 第一章 Hello World ASP.NET Core中使用GraphQL - 第二章 中间件 ASP ...

  9. springboot~如何去掌握它(新手可以看看)

    springboot~如何去掌握它 主讲:仓储大叔 每讲40分钟 架构图 graph LR App-->A Web-->A A(zuul proxy)-->B(eureka serv ...

  10. unity协程coroutine浅析

    转载请标明出处:http://www.cnblogs.com/zblade/ 一.序言 在unity的游戏开发中,对于异步操作,有一个避免不了的操作: 协程,以前一直理解的懵懵懂懂,最近认真充电了一下 ...