效果展示
wx.showNavigationBarLoading(Object object)
在當前頁面顯示導航條加載動畫
wx.showNavigationBarLoading參數
wx.hideNavigationBarLoading(Object object)
在當前頁面隱藏導航條加載動畫
wx.hideNavigationBarLoading參數
例如:
效果展示
代碼
index.wxml
<button bindtap="btnClick1" type="primary">顯示導航條加載動畫</button>
<button bindtap="btnClick2" type="primary">隱藏導航條加載動畫</button>
1
2
index.wxss
button{
margin: 20rpx;
}
1
2
3
index.js
Page({
data: { },
btnClick1:function(){
wx.showNavigationBarLoading()
},
btnClick2: function () {
wx.hideNavigationBarLoading()
}
})
1
2
3
4
5
6
7
8
9
wx.setNavigationBarTitle(Object object)
動態設置當前頁面的標題
wx.setNavigationBarTitle參數
wx.setNavigationBarColor(Object object)
設置頁面導航條顏色
wx.setNavigationBarColor參數
object.animation 的結構
object.animation.timingFunc 的合法值
例如:
展示效果
代碼
index.wxml
<!--index.wxml-->
<button bindtap="btnClick1" type="primary">顯示導航條加載動畫</button>
<button bindtap="btnClick2" type="primary">隱藏導航條加載動畫</button>
<button bindtap="btnClick3" type="primary">設置當前頁面的標題</button>
<button bindtap="btnClick4" type="primary">設置頁面導航條顏色</button>
1
2
3
4
5
index.wxss
button{
margin: 20rpx;
}
1
2
3
index.js
/*wx.setNavigationBarColor屬性
frontColor 前景顏色值,包括按鈕、標題、狀態欄的顏色,僅支持 #ffffff 和 #000000
backgroundColor 背景顏色值,有效值為十六進制顏色
animation 動畫效果
*/
/*animation 動畫效果
duration 動畫變化時間,單位 ms
timingFunc 動畫變化方式 'linear' 動畫從頭到尾的速度是相同的、'easeIn' 動畫以低速開始、'easeOut' 動畫以低速結束、'easeInOut' 動畫以低速開始和結束
*/
Page({
data: {
},
btnClick1:function(){
wx.showNavigationBarLoading()
},
btnClick2: function () {
wx.hideNavigationBarLoading()
},
btnClick3: function () {
wx.setNavigationBarTitle({
title: '改變后的導航欄文字',
})
},
btnClick4: function () {
wx.setNavigationBarColor({
frontColor: '#000000',//前景顏色值,包括按鈕、標題、狀態欄的顏色,僅支持 #ffffff 和 #000000
backgroundColor: '#FF9797',
animation:{
duration:1000,
timingFunc: 'easeInOut'
}
})
},
})
————————————————
版權聲明:本文為CSDN博主「鋼絲球 M.Siebel」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/jackjia2015/java/article/details/86574317