微信小程序progress組件使用詳解
本文為大家分享了微信小程序progress組件的使用方法,供大家參考,具體內(nèi)容如下
效果圖

WXML
<view class="tui-content">
<view class="tui-menu-list">
<text>show-info在進度條右側(cè)顯示百分比</text>
<progress percent="50" show-info />
</view>
<view class="tui-menu-list">
<text>stroke-width進度條線的寬度,單位px</text>
<progress percent="50" stroke-width="12" show-info/>
</view>
<view class="tui-menu-list">
<text>color進度條顏色</text>
<progress percent="50" color="red" show-info/>
</view>
<view class="tui-menu-list">
<text>active進度條從左往右的動畫</text>
<progress percent="50" active show-info/>
</view>
<view class="tui-menu-list">
<text>backgroundColor未選擇的進度條的顏色</text>
<progress percent="50" backgroundColor="blue" active show-info/>
</view>
<view class="tui-menu-list">
<text>動態(tài)設置進度條進度</text>
<progress percent="{{index}}" show-info/>
</view>
<view class="tui-tabbar-content">
<view class="tui-tabbar-group">
<text data-id="10" bindtap="changeTabbar" class="tui-tabbar-cell {{index == 10 ? 'tui-active' : ''}}">10%</text>
<text data-id="30" bindtap="changeTabbar" class="tui-tabbar-cell {{index == 30 ? 'tui-active' : ''}}">30%</text>
<text data-id="50" bindtap="changeTabbar" class="tui-tabbar-cell {{index == 50 ? 'tui-active' : ''}}">50%</text>
<text data-id="70" bindtap="changeTabbar" class="tui-tabbar-cell {{index == 70 ? 'tui-active' : ''}}">70%</text>
<text data-id="90" bindtap="changeTabbar" class="tui-tabbar-cell {{index == 90 ? 'tui-active' : ''}}">90%</text>
</view>
</view>
</view>
JS
Page({
data: {
index: 10
},
changeTabbar(e){
this.setData({ index: e.currentTarget.dataset.id})
}
})
progress屬性
percent:初始化所占百分比
show-info:進度條右側(cè)是否顯示進度條百分比
stroke-width:進度條寬度,單位px,默認為6
color:進度條顏色
activeColor:已選擇的進度條的顏色
backgroundColor:未選擇的進度條的顏色
active:進度條從左往右的動畫
active-mode:backwards: 動畫從頭播;forwards:動畫從上次結(jié)束點接著播
DEMO下載
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
JavaScript判斷一個變量是否是數(shù)組的五種方式總結(jié)
在 JavaScript 編程中,我們經(jīng)常需要對不同類型的變量進行判斷和處理,其中,判斷一個變量是否是數(shù)組是一項基本且常見的任務,在本篇博客中,我們將介紹幾種常用的方式來判斷一個變量是否是數(shù)組,并探討它們的優(yōu)缺點以及適用場景,需要的朋友可以參考下2023-11-11
JS使用Date對象實時顯示當前系統(tǒng)時間簡單示例
這篇文章主要介紹了JS使用Date對象實時顯示當前系統(tǒng)時間,涉及javascript基于定時器動態(tài)操作Date對象相關實現(xiàn)技巧,需要的朋友可以參考下2018-08-08
js點擊按鈕實現(xiàn)水波紋效果代碼(CSS3和Canves)
這篇文章主要為大家詳細介紹了點擊按鈕實現(xiàn)水波紋效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-09-09
基于Javascript實現(xiàn)網(wǎng)頁版的繪圖板
這篇文章主要為大家詳細介紹了如何基于HTML5 Canvas和jQuery實現(xiàn)的簡單網(wǎng)頁版繪圖編輯器,文中的示例代碼講解詳細,需要的小伙伴可以了解下2024-10-10

