Maison >Applet WeChat >Développement de mini-programmes >Introduction détaillée du composant View de l'applet WeChat
Cet article présente principalement les informations pertinentes sur l'introduction détaillée du composant View de l'applet WeChat. Les amis dans le besoin peuvent s'y référer
Quand j'ai vu cela pour la première fois. effet, c'était vraiment L'effet est cohérent avec ReactNative, et les propriétés sont fondamentalement les mêmes
view est un composant de vue très simple à utiliser.
Attributs principaux :
flex-direction : Deux attributs principaux : disposition horizontale en "ligne" disposition verticale en "colonne"
justifier- contenu L'alignement de l'axe principal (si la direction de flexion est en ligne, l'axe principal est horizontal)
Attributs facultatifs ('flex-start', 'flex-end', 'center', ' espace-entre', 'espace-autour')
align-items Alignement de l'axe transversal Si la direction de flexion est une rangée, l'axe transversal est vertical)
Attribut facultatif ('flex-start', 'flex-end', 'center')
wxml
<view class="page"> <view class="page__hd"> <text class="page__title">view</text> <text class="page__desc">弹性框模型分为弹性容器以及弹性项目。当组件的display为flex或inline-flex时,该组件则为弹性容器,弹性容器的子组件为弹性项目。</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; }
Pour une introduction plus détaillée au composant Afficher le mini-programme WeChat et aux articles associés, veuillez faire attention au site Web PHP chinois !