微信小程序 (八)View組件詳細(xì)介紹
剛看到這個(gè)效果的時(shí)候還真是和ReactNative的效果一致,屬性也基本的一樣.
view這個(gè)組件就是一個(gè)視圖組件使用起來非常簡(jiǎn)單。
主要屬性:
flex-direction: 主要兩個(gè)特性”row”橫向排列”column”縱向排列
justify-content 主軸的對(duì)齊方式(如果flex-direction為row則主軸就是水平方向)
可選屬性 (‘flex-start', ‘flex-end', ‘center', ‘space-between', ‘space-around')
align-items 側(cè)軸對(duì)齊方式如果flex-direction為row則側(cè)軸就是垂直方向)
可選屬性 (‘flex-start', ‘flex-end', ‘center')
wxml
<view class="page"> <view class="page__hd"> <text class="page__title">view</text> <text class="page__desc">彈性框模型分為彈性容器以及彈性項(xiàng)目。當(dāng)組件的display為flex或inline-flex時(shí),該組件則為彈性容器,彈性容器的子組件為彈性項(xiàng)目。</text> </view> <view class="page__bd"> <view class="section"> <view class="section__title">flex-direction: row</view> <view class="flex-wrp" style="flex-direction:row;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">flex-direction: column</view> <view class="flex-wrp" style="height: 300px;flex-direction:column;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">justify-content: flex-start</view> <view class="flex-wrp" style="flex-direction:row;justify-content: flex-start;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">justify-content: flex-end</view> <view class="flex-wrp" style="flex-direction:row;justify-content: flex-end;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">justify-content: center</view> <view class="flex-wrp" style="flex-direction:row;justify-content: center;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">justify-content: space-between</view> <view class="flex-wrp" style="flex-direction:row;justify-content: space-between;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">justify-content: space-around</view> <view class="flex-wrp" style="flex-direction:row;justify-content: space-around;"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">align-items: flex-end</view> <view class="flex-wrp" style="height: 200px;flex-direction:row;justify-content: center;align-items: flex-end"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">align-items: center</view> <view class="flex-wrp" style="height: 200px;flex-direction:row;justify-content: center;align-items: center"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> <view class="section"> <view class="section__title">align-items: center</view> <view class="flex-wrp" style="height: 200px;flex-direction:row;justify-content: center;align-items: flex-start"> <view class="flex-item" style="background: red"></view> <view class="flex-item" style="background: green"></view> <view class="flex-item" style="background: blue"></view> </view> </view> </view> </view>
wxss
.flex-wrp{ height: 100px; display:flex; background-color: #FFFFFF; } .flex-item{ width: 100px; height: 100px; }
相關(guān)文章:
hello WeApp icon組件
Window text組件 switch組件
tabBar底部導(dǎo)航 progress組件 action-sheet
應(yīng)用生命周期 button組件 modal組件
頁(yè)面生命周期 checkbox組件 toast組件
模塊化詳 form組件詳 loading 組件
數(shù)據(jù)綁定 input 組件 navigator 組件
View組件 picker組件 audio 組件
scroll-view組件 radio組件 video組件
swiper組件 slider組件 Image組件
- 微信小程序(九)scroll-view組件詳細(xì)介紹
- 微信小程序 picker-view 組件詳解及簡(jiǎn)單實(shí)例
- 微信小程序 scroll-view組件實(shí)現(xiàn)列表頁(yè)實(shí)例代碼
- 微信小程序新增的拖動(dòng)組件movable-view使用教程
- 微信小程序組件之srcoll-view的詳解
- 詳解微信小程序 通過控制CSS實(shí)現(xiàn)view隱藏與顯示
- 微信小程序 wxapp視圖容器 view詳解
- 微信小程序 教程之wxapp 視圖容器 view
- 微信小程序?qū)崿F(xiàn)動(dòng)態(tài)改變view標(biāo)簽寬度和高度的方法【附demo源碼下載】
相關(guān)文章
JS前端錯(cuò)誤監(jiān)控捕獲以及上報(bào)方法詳解
這篇文章主要為大家介紹了前端錯(cuò)誤監(jiān)控捕獲以及上報(bào)方法詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-01-01JavaScript中使用toLocaleString數(shù)字格式化處理詳解
這篇文章主要為大家介紹了JavaScript中使用toLocaleString數(shù)字格式化處理詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-08-08微信小程序 五星評(píng)分(包括半顆星評(píng)分)實(shí)例代碼
這篇文章主要介紹了微信小程序 五星評(píng)分(包括半顆星評(píng)分)實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下2016-12-12JS構(gòu)造函數(shù)和實(shí)例化的關(guān)系及原型引入
這篇文章主要介紹了JS構(gòu)造函數(shù)和實(shí)例化的關(guān)系及原型引入,下文圍繞JS構(gòu)造函數(shù)和實(shí)例化的關(guān)系及原型引入的西安海關(guān)資料展開全文內(nèi)容,需要的朋友可以參考一下,希望對(duì)大家有所幫助2021-11-11