這篇文章主要講解了“小程序中怎么實現(xiàn)view視圖容器”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“小程序中怎么實現(xiàn)view視圖容器”吧!
創(chuàng)新互聯(lián)建站專注于桑植企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站建設(shè),購物商城網(wǎng)站建設(shè)。桑植網(wǎng)站建設(shè)公司,為桑植等地區(qū)提供建站服務(wù)。全流程按需求定制開發(fā),專業(yè)設(shè)計,全程項目跟蹤,創(chuàng)新互聯(lián)建站專業(yè)和態(tài)度為您提供的服務(wù)
視圖容器
// wxmlflex-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; }
圖片
// wxmlflex-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; }
圖片
// wxmljustify-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
// wxmljustify-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
// wxmljustify-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
// wxmljustify-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
// wxmljustify-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
// wxmljustify-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 | 縱向排列 |
項目內(nèi)容對齊(justify-content) | 描述 |
---|---|
flex-start | 向行頭緊挨 |
flex-end | 向行尾緊挨 |
center | 居中緊挨 |
space-between | 平均分布 |
space-around | 平均分布 ,兩邊留有一半間隔 |
space-evenly | 兩邊間隔與中間相同 |
源碼
// wxmlflex-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; }
感謝各位的閱讀,以上就是“小程序中怎么實現(xiàn)view視圖容器”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對小程序中怎么實現(xiàn)view視圖容器這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!