配置uni-app导航栏上的搜索框

Posted on 2019-09-13 22:39  猫头唔食鱼  阅读(7606)  评论(0编辑  收藏  举报

page下的style选项根据官方文档配置即可

https://uniapp.dcloud.io/collocation/pages?id=pages

 

例子:

{
    "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
        {
            "path": "pages/index/index",
            "style": {
                 "app-plus":{
                     "titleNView":{
                         "searchInput":{
                             "align":"center",
                             "backgroundColor":"#eee",
                             "borderRadius":"5px", // 只能用px作单位
                             "placeholder":"请输入内容",
                             "placeholderColor":"#ccc"
                         }
                     }
                 }
            }
        }
    ],
    "globalStyle": {
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "uni-app",
        "navigationBarBackgroundColor": "#F8F8F8",
        "backgroundColor": "#F8F8F8"
    }
}

 

效果: