日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

微信小程序--動態設置導航欄顏色

作者:Dark_programmer 更新時間: 2022-07-21 編程語言

微信小程序--動態設置導航欄顏色

既然要動態設置導航欄顏色,估計 自定義導航欄 也跑不了

關于動態設置導航欄顏色,微信小程序官方文檔給出了一個API: wx.setNavigationBarColor

官方給出的示例:

wx.setNavigationBarColor({
  frontColor: '#ffffff',
  backgroundColor: '#ff0000',
  animation: {
    duration: 400,
    timingFunc: 'easeIn'
  }
})

我的實際使用:

    wx.setNavigationBarColor({
      frontColor: '#ffffff',
      backgroundColor: '#ffffff',
      animation: {
        duration: 400,
        timingFunc: 'easeIn'
      },
      success: () => {
        console.log('設置成功')
      },
      fail: () => {
        console.log('設置失敗')
      },
      complete: () => {
        console.log('設置結束')
      },
    })

需要注意的是:

  • frontColor只有兩個選擇:#ffffff #000000
  • frontColorbackgroundColor兩個都需要設置

原文鏈接:https://blog.csdn.net/Dark_programmer/article/details/125895873

欄目分類
最近更新