微信小程序开发文档字段介绍,让您开发小程序理解更加深刻,下面我们举例介绍常用的文档字段:
作用:控制页面目录
在小程序开发时,每个页面都对应一个目录,每个目录又分别有wxml、wxss、js和json四个文件。详细说明可查看后续文章介绍,本文主要详解全局配置文件。
该字段内容是一个json字符串,key和value都需要用引号包含。
"window":{ "backgroundTextStyle":"light", "navigationBarBackgroundColor": "#eb4450", "navigationBarTitleText": "标题名称", "navigationBarTextStyle":"white" },
backgroundTextStyle:下拉 loading 的样式,仅支持 dark / light。
navigationBarBackgroundColor:导航栏背景颜色,如 #000000。
navigationBarTitleText:导航栏标题文字内容。
navigationBarTextStyle:导航栏标题颜色,仅支持 black / white。
更多属性请移步微信开放文档中查看。
作用:控制导航条样式和内容。
"tabBar": { "color": "#999", "selectedColor": "#ff2d4a", "backgroundColor": "#fafafa", "position": "bottom", "borderStyle": "black", "list": [ { "pagePath": "pages/index/index", "text": "首页", "iconPath": "./icon/主页0.png", "selectedIconPath": "./icon/主页1.png" }, { "pagePath": "pages/category/index", "text": "分类", "iconPath": "./icon/分类0.png", "selectedIconPath": "./icon/分类1.png" }, { "pagePath": "pages/cart/index", "text": "购物车", "iconPath": "./icon/购物车0.png", "selectedIconPath": "./icon/购物车1.png" }, { "pagePath": "pages/user/index", "text": "我的", "iconPath": "./icon/我的0.png", "selectedIconPath": "./icon/我的1.png" } ] },
控制的正是图中的内容
color:tab 上的文字默认颜色,仅支持十六进制颜色。
selectedColor:tab 上的文字选中时的颜色,仅支持十六进制颜色。
backgroundColor:tab 的背景色,仅支持十六进制颜色。
position:tabBar 的位置,仅支持 bottom / top。
borderStyle:tabbar 上边框的颜色, 仅支持 black / white。
list属性
pagePath:指定点击后要跳转的页面路径。
text:显示的页面名称。
iconPath:未被点击时的图标图片。
selectedIconPath:被点击后的图标图片。
上一篇:没有了
下一篇:没有了