亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

微信小程序 簡單DEMO布局,邏輯,樣式的練習(xí)

 更新時(shí)間:2016年11月30日 16:05:38   作者:LiuJun2Son  
這篇文章主要介紹了微信小程序 簡單DEMO布局,邏輯,樣式的練習(xí)的相關(guān)資料,這里寫一個(gè)簡單實(shí)例練習(xí)小程序的布局,并附實(shí)例代碼和實(shí)現(xiàn)效果圖,需要的朋友可以參考下

微信小程序 布局實(shí)例:

下面將會按照以下的順序介紹:

布局的實(shí)現(xiàn)
邏輯的實(shí)現(xiàn)
樣式的實(shí)現(xiàn)

1.布局的實(shí)現(xiàn)

最大的布局是view, view布局中包含了:一張圖片,文字描述,信息欄和分界線

<!--最外層-->
<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>






  <!--圖片層(下面的代碼直接復(fù)制了上面的所有布局代碼)-->
  <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.邏輯的實(shí)現(xiàn)

只是注冊了Page界面

Page({

  data:{

  }

})

3.樣式的實(shí)現(xiàn)

.home-view1樣式:display規(guī)定最大View布局為彈性布局,justify-content規(guī)定內(nèi)容居中,豎直排列, …

.home-view3樣式:display規(guī)定了信息欄布局為彈性布局,justify-content規(guī)定內(nèi)容水平平均分配

.home-view4樣式:display規(guī)定了收藏圖片和收藏?cái)?shù)的父布局為彈性布局,align-items規(guī)定內(nèi)容在豎直方向居中

.home-image1樣式:規(guī)定圖片的高度

.home-image-heart樣式:規(guī)定收藏圖片的大小

.home-text1樣式:規(guī)定描述文字的樣式,text-align規(guī)定文字居中,line-height規(guī)定兩行文字之間的高度

.home-text-heart樣式:規(guī)定收藏?cái)?shù)的樣式,border-radius規(guī)定邊界圓角

.home-view-line樣式:是一條分界線

.bgColor樣式:規(guī)定收藏?cái)?shù)的背景

.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;
}

4.效果圖

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論