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

學(xué)無先后,達(dá)者為師

網(wǎng)站首頁 編程語言 正文

uni-app 導(dǎo)航欄自定義圖標(biāo)及圖標(biāo)的點(diǎn)擊事件

作者:海鷗-w 更新時(shí)間: 2023-07-13 編程語言

uniapp導(dǎo)航欄配置自定義按鈕

{
	"path" : "pages/weshare/ws-index/ws-index",
	"style" : {
		"navigationBarTitleText": "微享WeShare",
		"enablePullDownRefresh":true,
		"app-plus": {
			"titleNView": {
				"buttons": [
					{
						"color":"#fff",
						"float":"right",
						"fontSize":"32px",
						"type": "menu", 
                     "signType": "menuBtn" 
					},
					{
						"color":"#fff",
						"float":"right",
						"fontSize":"20px",
						"fontSrc":"/static/iconfont/iconfont.ttf",  //此處有說明,見下方
						"text": "\ue672",  //自定義按鈕
                                                "signType": "homeBtn"
					}
				]
			}
		}
	}	
},

關(guān)于iconfont.ttf文件的引用及說明
unicode形式的使用說明:
如上圖,將 &#x 替換為 \u 即可。如 &#xe737 -> \ue737
unicode不生效的說明:
若新增了icon圖庫,并更新了iconfont.css和iconfont.ttf文件,則需要重新運(yùn)行app基座才行,否則不生效。

關(guān)于導(dǎo)航欄自定義按鈕點(diǎn)擊事件的監(jiān)聽
監(jiān)聽按鈕、輸入框事件,uni-app給出了相應(yīng)API,只需把onNavigationBarButtonTap和onNavigationBarSearchInputChanged,寫在響應(yīng)的頁面中即可
//監(jiān)聽原生導(dǎo)航欄按鈕點(diǎn)擊事件
onNavigationBarButtonTap(e){
console.log(e)
},

原文鏈接:https://blog.csdn.net/weixin_50379372/article/details/128162681

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新