uni-app自定義導航欄(搜索框和按鈕)


參考網址:https://blog.csdn.net/yinge0508/article/details/98100240

pages.json中配置app-plus:searchInput

"pages": [
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarBackgroundColor": "#00c170",
                "app-plus": {
                    "bounce": "none",
                    "titleNView": {
                        "buttons": [ 
                            {
                                "text": "搜索", 
                                "fontSize":"16",
                                "float": "right",
                                "color":"#fff"
                            },
                        ],
                        "searchInput":{
                                "align": "center",
                                "placeholder": "請輸入查找房源信息",
                                "borderRadius":"50upx",
                                "backgroundColor": "#fff"
                            }
                    }
                }
            }
        }
    ]

監聽輸入框和按鈕事件

在需要監聽的頁面寫

onNavigationBarButtonTap(val) {
    console.log("val")
},
onNavigationBarSearchInputChanged (val) {
     console.log("val")
}    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM