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