小程序全局配置和页面内配置

全局配置
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": "./images/_home.png", // tab未选中时的图标
		        "selectedIconPath": "./images/home.png" // tab选中时的图标
		      },
		      {
		        "pagePath": "pages/global/global",
		        "text": "全局",
		        "iconPath": "./images/_img.png",
		        "selectedIconPath": "./images/img.png"
		      },
		      {
		        "pagePath": "pages/second/second",
		        "text": "二级",
		        "iconPath": "./images/_my.png",
		        "selectedIconPath": "./images/my.png"
		      },
		      {
		        "pagePath": "pages/first/fist",
		        "text": "一级",
		        "iconPath": "./images/_search.png",
		        "selectedIconPath": "./images/search.png"
		      }
		    ]
	}

在这里插入图片描述
页面内的配置
在page对应的json文件中添加配置以配置导航栏的title为例

	"navigationBarTitleText": "二级"

在这里插入图片描述
也可以在js文件中修改title的配置
比如global.js中加入如下配置

onLoad: function(options) {
	wx.setNavigationBarTitle({
      title: '帅比源',
      success: function(res) {},
      fail: function(res) {},
      complete: function(res) {},
    })
} 

在这里插入图片描述
js配置>页面自己的json文件的配置>全局配置

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值