小程式開發基礎-view檢視容器
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
微信小程式分享
相關文章
- 微信小程式-檢視容器元件微信小程式元件
- 小程式開發基礎(一)
- app,小程式開發基礎知識APP
- 微信小程式開發系列二:微信小程式的檢視設計微信小程式
- 小程式開發之基礎知識(0)
- 小程式-雲開發 bindscroll滾動事件執行setData()方法,導致scroll-view檢視抖動事件View
- 微信小程式開發系列(一) :開發環境搭建和微信小程式的檢視設計與開發微信小程式開發環境
- 微信小程式-檢視檢視引用微信小程式
- 視訊開發基礎篇
- MySQL View 檢視MySqlView
- 關於自定義檢視容器(Container View Controller)AIViewController
- iOS開發小記-基礎篇iOS
- 微信小程式-元件-滑塊檢視容器-swiper 的一個坑微信小程式元件
- 微信小程式-檢視微信小程式
- View基礎View
- 小程式基礎
- 提升開發效率,小程式容器來幫你
- 微信小程式開發基礎(一)「配置」與「邏輯層」微信小程式
- 大眾點評點餐小程式開發經驗 - 檢視層
- materialized view (物化檢視)ZedView
- 微信小程式-檢視模板微信小程式
- 微信小程式-檢視事件微信小程式事件
- 微信小程式開發教程(基礎篇)3-app.js 解析微信小程式APPJS
- 動態效能檢視基礎
- iOS開發基礎篇--NSNotificationCenter使用小結iOS
- iOS開發 如何通過檢視(view)獲取該檢視所在的控制器(viewController)iOSViewController
- MySQL View(檢視)詳解MySqlView
- 檢視所有VIEW/TABLE in MSSQLViewSQL
- 微信小程式-檢視列表渲染微信小程式
- 微信小程式開發–視訊教程系列微信小程式
- corejava基礎知識(6)-檢視Java
- Django基礎之三(類檢視)Django
- 【Flutter 基礎】 檢視佈局-前言Flutter
- sql大資料 基礎(檢視)SQL大資料
- 微信小程式開發之大神之路最全微信小程式開發教程(視訊+精品文章)微信小程式
- 【秒懂音視訊開發】05_Qt開發基礎QT
- ASP.Net MVC開發基礎學習筆記(10):分部檢視PartialViewASP.NETMVC筆記View
- React Native 小例項 採用View佈局如下檢視React NativeView