小程序動(dòng)態(tài)設(shè)置 tabBar 某一項(xiàng)的內(nèi)容wx.setTabBarItem
	   wx.setTabBarItem(Object object)
動(dòng)態(tài)設(shè)置 tabBar 某一項(xiàng)的內(nèi)容,2.7.0 起圖片支持臨時(shí)文件和網(wǎng)絡(luò)文件。
參數(shù)
Object object
屬性    類(lèi)型    默認(rèn)值    必填    說(shuō)明
index    number        是    tabBar 的哪一項(xiàng),從左邊算起
text    string        否    tab 上的按鈕文字
iconPath    string        否    圖片路徑,icon 大小限制為 40kb,建議尺寸為 81px * 81px,當(dāng) postion 為 top 時(shí),此參數(shù)無(wú)效
selectedIconPath    string        否    選中時(shí)的圖片路徑,icon 大小限制為 40kb,建議尺寸為 81px * 81px ,當(dāng) postion 為 top 時(shí),此參數(shù)無(wú)效
success    function        否    接口調(diào)用成功的回調(diào)函數(shù)
fail    function        否    接口調(diào)用失敗的回調(diào)函數(shù)
complete    function        否    接口調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會(huì)執(zhí)行)
示例代碼
wx.setTabBarItem({
  index: 0,
  text: 'text',
  iconPath: '/path/to/iconPath',
  selectedIconPath: '/path/to/selectedIconPath'
})
	   
 作者:大學(xué)生新聞網(wǎng)    來(lái)源:大學(xué)生新聞網(wǎng)
發(fā)布時(shí)間:2025-04-05    閱讀: