全部產品
Search
文件中心

SuperApp:導覽列

更新時間:Oct 29, 2024

本文介紹小程式導覽列相關的JSAPI,供您更新小程式導覽列的視覺效果。

WVNavigationBar.update

動態設定當前頁面的標題列。

輸入參數:

  • [string] title:可選,頁面標題。

  • [string] titleColor:可選,頁面標題的顏色,RGB值。

  • [string] barStyle:可選,小程式bar的樣式,float是浮在頁面之上的,normal是正常的頁面在bar下面。

  • [string] backgroundColor:可選,頁面標題列的背景顏色,RGB值。

  • [string] hideBackButton:可選,是否隱藏返回按鈕,預設顯示,true是隱藏,非true是顯示。

  • [string] theme:控制右邊按鈕的主題色。light是淺色按鈕,dark是深色按鈕。預設是dark。

回調參數:

無回調參數,如果成功顯示載入提示框,則進入success回調,否則進入failure回調。

var params = {
  title: 'Home',
  titleColor: '#FF00FF',
  barStyle: 'float',
  backgroundColor: '#00FFFF',
  hideBackButton: 'false'
};

window.WindVane.call('WVNavigationBar', 'update', params, function(e) {
}, function(e) {
  alert('failure: ' + JSON.stringify(e));
});

WVNavigationBar.getHeight

擷取小程式標題列高度。

輸入參數:

無。

回調參數:

  • [int] height:高度。

  • [int] screenWidth:螢幕寬度。

  • [int] screenHeight:螢幕高度。

window.WindVane.call('WVNavigationBar', 'getHeight', params, function(e) {
        alert('success:' + JSON.stringify(e));
}, function(e) {
        alert('failure:' + JSON.stringify(e));
});