微信小程序单独设置右上角胶囊颜色

1.微信小程序全局颜色一般在app.json中设置:

 "pages": [
    "pages/index/index",
    "pages/logs/logs",
    "pages/login/index",
    "pages/coupn/index",
    "pages/success/index",
    "pages/wxOffList/index",
    "pages/useCoupon/index",
    "pages/failCoupon/index"
  ],
  "window": {
    "navigationBarBackgroundColor": "#ffffff",
    "navigationBarTextStyle": "black",
    "backgroundColor": "#eeeeee",
    "backgroundTextStyle": "light",
    "navigationStyle": "custom"
  }

2.单独设置就在自己的页面index.json中设置代码如下:

{
  "usingComponents": {
    "van-button": "/vant/button/index",
    "van-cell-group": "/vant/cell-group/index",
    "van-cell": "/vant/cell/index",
    "van-field": "/vant/field/index",
    "van-toast": "/vant/toast/index",
    "van-dialog": "/vant/dialog/index",
    "van-nav-bar": "/vant/nav-bar/index",
    "van-tabbar": "/vant/tabbar/index",
    "van-tabbar-item": "/vant/tabbar-item/index",
    "van-icon": "/vant/icon/index"
  },
     "navigationBarTextStyle": "white"
 }

直接在页面.json中加入   "navigationBarTextStyle": "white"   就行

我这里全局设的black色,在index页面设置的white颜色。

发布了117 篇原创文章 · 获赞 37 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/samHuangLiang/article/details/99671051