国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

微信小程序 基礎(chǔ)組件與導(dǎo)航組件詳細(xì)介紹

2019-11-19 17:28:21
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

微信小程序 基礎(chǔ)組件與導(dǎo)航組件詳解:

    1.基礎(chǔ)組件

       1.1 圖標(biāo) icon

       1.2 文本 text

       1.3 進(jìn)度條 progress

    2.導(dǎo)航組件(navigator)

 1.基礎(chǔ)組件   

1.1 圖標(biāo) icon

(1)總結(jié)


(2) 案例

    效果截圖


    page.wxml

<view class="type-group"> <block wx:for="{{iconType}}">  <icon type="{{item}}" size="40"/> </block></view>

  page.js

//獲取應(yīng)用實(shí)例var app = getApp()Page({ data:{ iconType:[  'success','success_circle','success_on_circle','waiting','waiting_circle','safe_success','safe_warn','warn','info',  'info_circle','circle','download','cancel','search','clear' ] },})

  1.2 文本 text

(1) 案例

    效果圖


    page.wxml

<view class="main"> <view class="text-view">  <text class="show-text">{{text}}</text> </view> <view class="bt-view">  <button bindtap="addLine" class="show-text">{{add}}</button>  <button bindtap="removeLine" class="show-text">{{remove}}</button> </view> </view>

    page.js

//獲取應(yīng)用實(shí)例var app = getApp()//定義額外的文本內(nèi)容數(shù)組var extraLine = [];//初始化文本var init='Initdata! /n'Page({ data:{ text:init, add:'添加', remove:'刪除' },/**添加一行內(nèi)容 */addLine:function(e){ extraLine.push("This line is new add!") this.setData({  text:init+extraLine.join('/n') })},/**刪除一行內(nèi)容 */removeLine:function(e){ if (extraLine.length > 0) {  extraLine.pop()  this.setData({  text:init + '/n' + extraLine.join('/n')  }) }},})

    page.wxss

.show-text{ font-size: 10pt; margin-left: 20rpx; font-family: 'Times New Roman', Times, serif; font-weight: bold;}.text-view{ padding: 10rpx;}button{ margin: 10rpx;}

 1.3 進(jìn)度條 progress

(1)總結(jié)

 

(2)案例

    效果圖

   

    page.wxml

<view class="progress-view"> <progress percent="50"/> <progress percent="20" stroke-width="10" show-info/> <progress percent="40" color="#000"/> <progress percent="100" active/></view>

    page.wxss

progress{ margin: 50rpx;}

 2.導(dǎo)航組件(navigator)

(1) 總結(jié)


(2) 案例

    效果圖


    

     main.wxml

<view class="nav-view"> <navigator open-type="navigate" url="../navigator/navigator" class="nav-item" hover-class="nav-hover">導(dǎo)航到新頁(yè)面</navigator> <navigator open-type="redirect" url="../navigator/navigator" class="nav-item" hover-class="nav-hover">當(dāng)前頁(yè)面</navigator> <navigator open-type="switchTab" url="../index/index" class="nav-item" hover-class="nav-hover">切換Tab</navigator></view>

    main.wxss

.nav-hover{ color: white; background-color: black;}.nav-item{ margin: 20rpx; font-family: 'Times New Roman', Times, serif; font-weight: bold; padding: 10rpx; display: inline-flex;}

    navigator.wxml

<view class="info">導(dǎo)航到的新頁(yè)面</view>

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

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 双流县| 综艺| 鄯善县| 金沙县| 井研县| 堆龙德庆县| 从江县| 邵武市| 特克斯县| 霍山县| 英德市| 北海市| 天全县| 禄丰县| 贵溪市| 平陆县| 康定县| 大同市| 石屏县| 望奎县| 洛浦县| 镇原县| 静乐县| 张家港市| 巴中市| 凤庆县| 波密县| 濮阳市| 汽车| 屯门区| 元阳县| 韩城市| 清远市| 盐城市| 敖汉旗| 都江堰市| 建始县| 贵州省| 亚东县| 仙居县| 宁陕县|