微信小程序【全局配置和頁面內配置】

全局配置:  官方文檔

app.json文件中這裏以配置頂部title和tabbar爲例:

"window": {
  "backgroundTextStyle": "light", // background中文本的顏色 他的值只有light和dark
  "navigationBarBackgroundColor": "#000", // 頂部導航的背景色
  "navigationBarTitleText": "微信接口功能演示", // 頂部導航的title
  "navigationBarTextStyle": "white", // 頂部導航的字體顏色
  "enablePullDownRefresh": true, // 該屬性設置爲true的時候才能下來出現background部分
  "backgroundColor": "#f6f6f6" // background部分的背景色
},
"tabbar": {
  "color": "tab未選中的時候的字體顏色",
  "selectedColor": "tab選中的時候的字體顏色",
  "list": [ // list的數組長度必須在 2 - 5 之間 (包含2和5)
    {
      "pagePath": "pages/index/index",  // tabbar對應的頁面鏈接
      "text": "首頁",  // tab對應的文本
      "iconPath": "icon/_home.png",  // tab未選中時的圖標
      "selectedIconPath": "icon/home.png"  // tab選中時的圖標
    },
    {
      "pagePath": "pages/img/img",
      "text": "圖庫",
      "iconPath": "icon/_img.png",
      "selectedIconPath": "icon/img.png"
    },
    {
      "pagePath": "pages/mine/mine",
      "text": "我的",
      "iconPath": "icon/_my.png",
      "selectedIconPath": "icon/my.png"
    },
    {
      "pagePath": "pages/search/search",
      "text": "搜索",
      "iconPath": "icon/_search.png",
      "selectedIconPath": "icon/search.png"
    }
  ]
}

頁面內的配置

在page對應的json文件中添加配置以配置導航欄的title爲例:

  "navigationBarTitleText": "我的圖庫"

也可以在js文件中修改title的配置
比如global.js中加入如下配置

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章