Home > Article > WeChat Applet > Mini program development DEMO example
WeChat applet layout example:
The following will be introduced in the following order:
Implementation of layout
Implementation of logic
Implementation of style
1. Layout implementation
The largest layout is view. The view layout includes: a picture, text description, information bar and dividing line
<!--最外层--> <view class="home-view1"> <!--图片层--> <view class="home-view2"> <image class="home-image1" src="http://qty83k.creatby.com/materials/origin/640e31829b8776967dedc670b5427d0f_origin.jpg"></image> </view> <!--描述层--> <text class="home-text1">小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物</text> <!--信息层--> <view class="home-view3"> <view class="home-view4" > <image class="home-image-heart" src="http://qty83k.creatby.com/materials/origin/c5656ef00d38d89eae437c5a9102f8fa_origin.png"></image> <text class="home-text-heart bgColor" > 22</text> </view> <text class="home-text-time" >2016.10.29</text> </view> <!--分界线line--> <view class="home-view-line"></view> <!--图片层(下面的代码直接复制了上面的所有布局代码)--> <view class="home-view2"> <image class="home-image1" src="http://qty83k.creatby.com/materials/origin/640e31829b8776967dedc670b5427d0f_origin.jpg"></image> </view> <!--描述层--> <text class="home-text1">小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物</text> <!--信息层--> <view class="home-view3"> <view class="home-view4" > <image class="home-image-heart" src="http://qty83k.creatby.com/materials/origin/c5656ef00d38d89eae437c5a9102f8fa_origin.png"></image> <text class="home-text-heart bgColor" > 22</text> </view> <text class="home-text-time" >2016.10.29</text> </view> <!--分界线line--> <view class="home-view-line"></view> </view>
2 .Logic implementation
Just registers the Page interface
Page({ data:{ } })
3.Style implementation
.home-view1 style:displaySpecifies the maximum View layout It is a flexible layout, justify-content specifies that the content is centered and arranged vertically, ...
.home-view3 style: display specifies that the information bar layout is a flexible layout, justify-content specifies Content is evenly distributed horizontally
.home-view4 style: display specifies that the parent layout of collection pictures and collection numbers is a flexible layout, and align-items specifies that the content is centered vertically
.home- image1 style: specifies the height of the image
.home-image-heart style: specifies the size of the collected image
.home-text1 style: specifies the style of the description text, text-align Specifies the text to be centered, line-heightSpecifies the height between two lines of text
.home-text-heart style: specifies the style of the collection number, border-radius specifies the border rounded corners
.home-view-line style: is a dividing line
.bgColor style: specifies the background of the collection number
.home-view1{ display: flex; justify-content: center; flex-direction: column; height: 100%; width: 100%; margin: 6px; } .home-view3{ display: flex; justify-content: space-between; } .home-view4{ display: flex; align-items: center; } .home-image1{ height: 200px; } .home-image-heart{ width: 30px; height: 30px; } .home-text1{ text-align: left; line-height: 25px; margin-top: 6px; margin-right: 6px; color: gray; } .home-text-heart{ width: 22px; height: 22px; margin-left: 10px; border-radius: 20%; pad: 5px; text-align: center; } .home-text-time{ text-align: center; margin-right: 20px; padding-top: 5px; color: gray; } .home-view-line{ width: 100%; height: 6px; margin-top: 5px; background-color: gainsboro; } .bgColor{ background-color: lightblue; opacity: 0.6; }
[Related Recommendation】
1. Complete source code download of WeChat mini program
2. WeChat mini program learning demo: chat room + audio and video + adding content
The above is the detailed content of Mini program development DEMO example. For more information, please follow other related articles on the PHP Chinese website!