欧洲变态另类zozo,欧美xxxx做受欧美gaybdsm,欧洲熟妇色xxxx欧美老妇软件,免费人成视频xvideos入口 ,欧美.日韩.国产.中文字幕

歡迎光臨本站
我們一直在努力

微信小程序中UI與容器組件的介紹

這篇文章主要介紹了微信小程序 ui與容器組件總結(jié)的相關(guān)資料,需要的朋友可以參考下

微信小程序 UI與容器組件總結(jié)

    1.總結(jié)與概述

    2.容器組件

            2.1 組件容器(view)

            2.2 可滾動視圖容器(scroll-view)

            2.3 滑塊視圖容器(swiper)

1.總結(jié)與概述

1.1 UI組件總結(jié)圖

 1.2 概述

        小程序的UI組件也就是定義用戶界面的一系列標簽,類似于html標簽。一個完整用戶響應(yīng)過程:事件觸發(fā)——>UI組件接收到事件——>觸發(fā)js函數(shù)響應(yīng)事件——>更新UI

 2.容器組件

2.1 容器組件(view)

    (1)總結(jié)

    (2)例子

        效果圖

        page.wxml

<view>
 <text class="row-view-title">水平布局:</text>
 <view class="flex-wrp-row">
  <view class="flex-item-red" hover="true" hover-class="hover-style"><text class="color-text">red</text></view>
  <view class="flex-item-green" hover="true" hover-class="hover-style"><text class="color-text">green</text></view>
  <view class="flex-item-blue" hover="true" hover-class="hover-style"><text class="color-text">blue</text></view>
 </view>
</view>
<view>
 <text class="column-view-title">垂直布局:</text>
 <view class="flex-wrp-column" >
  <view class="flex-item-red" hover="true" hover-class="hover-style"><text class="color-text" >red</text></view>
  <view class="flex-item-green" hover="true" hover-class="hover-style"><text class="color-text">green</text></view>
  <view class="flex-item-blue" hover="true" hover-class="hover-style"><text class="color-text">blue</text></view>
 </view>
</view>
登錄后復制

page.wxss

.flex-item-red{
 background-color: red;
 height: 200rpx;
 width: 200rpx;
 text-align: center;
 line-height: 200rpx;
}
.flex-item-green{
 background-color: green;
 height: 200rpx;
 width: 200rpx;
 text-align: center;
 line-height: 200rpx
}
.flex-item-blue{
 background-color: blue;
 height: 200rpx;
 width: 200rpx;
 text-align: center; 
 line-height: 200rpx 
}
.flex-wrp-row{
 flex-direction: row;
 display: flex;
 margin-left: 10rpx;
 margin-top: 20rpx;
}
.flex-wrp-column{
 flex-direction: column;
 display: flex;
 margin-left: 10rpx;
  margin-top: 20rpx;
}
.color-text{
 color: snow;
 font-family: 'Times New Roman', Times, serif;
 font-weight: bold;
}
.hover-style{
 background-color: black;
}
.row-view-title,.column-view-title{
 margin-left: 20rpx;
 font-family: 'Times New Roman', Times, serif;
 font-weight: bold;
}
/*重要屬性:
 display: flex; //與display:box;是類似,是flexbox的最新語法格式,有更好的適配效果
 flex-direction: column; //表示子布局垂直布局
 flex-direction: row; //表示子布局為水平布局
*/
登錄后復制

2.2 可滾動視圖容器(scroll-view)

(1) 總結(jié)

(2) 例子

效果圖:

page.wxml

<view>
<text>水平滾動布局</text>
</view>
<view class="x-view">
 <scroll-view class="scroll-view-x" scroll-x="true" bindscrolltoupper="scrollXToUpper" bindscrolltolower="scrollXToLower" bindscroll="scroll" scroll-left="0" scroll-into-view="{{green}}">
  <view id="green" class="x_green"></view>
  <view id="red" class="x_red"></view>
  <view id="yellow" class="x_yellow"></view>
  <view id="blue" class="x_blue"></view>
 </scroll-view>
</view>
<view>
<text>垂直滾動布局</text>
</view>
<view class="y-view">
 <scroll-view class="scroll-view-y" scroll-y="true" bindscrolltoupper="scrollYToUpper" bindscrolltolower="scrollYToLower" bindscroll="scroll" scroll-top="0" scroll-into-view="{{green}}">
  <view id="green" class="y_green"></view>
  <view id="red" class="y_red"></view>
  <view id="yellow" class="y_yellow"></view>
  <view id="blue" class="y_blue"></view>
 </scroll-view>
</view>
登錄后復制

page.wxss

.x_green{
 background-color: green;
 width: 500rpx;
 height: 300rpx;
 display: inline-flex;
}
.x_red{
 background-color: red;
 width: 500rpx;
 height: 300rpx;
 display: inline-flex;

}
.x_blue{
 background-color: blue;
 width: 500rpx;
 height: 300rpx;
 display: inline-flex; 
}
.x_yellow{
 background-color: yellow;
 width: 500rpx;
 height: 300rpx; 
 display: inline-flex; 
}
.y_green{
 background-color: green;
 width: 100%;
 height: 300rpx;
}
.y_red{
 background-color: red;
 width: 100%;
 height: 300rpx;
}
.y_yellow{
 background-color: yellow;
 width: 100%;
 height: 300rpx;
}
.y_blue{
 background-color: blue;
 width: 100%;
 height: 300rpx;
}
.scroll-view-x{
 display: flex;
 white-space: nowrap;
 width: 100%;
 margin-bottom: 20px;
 margin-top: 10px; 
 height: 300rpx; 
}
.scroll-view-y{
 height: 400rpx;
}
/*重要屬性:
 white-space: nowrap;//設(shè)置內(nèi)部元素不換行顯示,與display: inline-flex;屬性聯(lián)合使用才會有水平布局的效果
*/
登錄后復制

page.js

//index.js
//獲取應(yīng)用實例
var app = getApp()
//var color_index=['green','red','yellow','blue'];
Page({
 data:{
 toview:'red',
 },
/*滑動到左邊觸發(fā)*/
scrollXToUpper:function(){
 console.log('scrollXToUpper')
},
/*滑動到右邊觸發(fā) */
scrollXToLower:function(){
 console.log('scrollXToLower')
},
/*滑動到頂部觸發(fā)*/
scrollYToUpper:function(){
 console.log('scrollYToUpper')
},
/*滑動到左邊觸發(fā) */
scrollYToLower:function(){
 console.log('scrollYToLower')
},
/*滑動觸發(fā) */
scroll:function(){
 console.log("scroll")
},
onLoad: function () {
 console.log('onLoad')
 var that = this
 },
})
登錄后復制

2.3 滑塊視圖容器(swiper)

(1)總結(jié)

(2)例子

效果圖:

page.wxml

<swiper data-current="0" current="0" bindchange="itemChangeFunc" circular="true" indicator-dots="{{indicatorDots}}"
 autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
 <block wx:for="{{imgUrls}}" wx:key="swiperkeys">
  <swiper-item>
  <image src="{{item}}" class="slide-image" width="355" height="150"/>
  </swiper-item>
 </block>
</swiper>
登錄后復制

page.js

//game.js
Page({
 data: {
 imgUrls: [
  '/image/wechat.png',
  'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
  'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
  'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
 ],
 indicatorDots: true,
 autoplay: true,
 interval: 3000,
 duration: 1000,
 current:1,
 },

 durationChange: function(e) {
 this.setData({
  duration: e.detail.value
 })
 },
 durationChange: function(e) {
 this.setData({
  duration: e.detail.value
 })
 },
itemChangeFunc:function(e){
 // console.log(e.target.dataset.current)

 console.log(e.detail)
}
})
登錄后復制

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,更多相關(guān)內(nèi)容請關(guān)注PHP中文網(wǎng)!

相關(guān)推薦:

以上就是微信小程序中UI與容器組件的介紹的詳細內(nèi)容,更多請關(guān)注有卡有網(wǎng)。

版權(quán)聲明:本文采用知識共享 署名4.0國際許可協(xié)議 [BY-NC-SA] 進行授權(quán)
文章名稱:《微信小程序中UI與容器組件的介紹》
文章鏈接:http://www.ljxxtl.cn/kaquan-baike/xcx/154656.html
本站資源僅供個人學習交流,請于下載后24小時內(nèi)刪除,不允許用于商業(yè)用途,否則法律問題自行承擔。