老师要我们学习一下微信小程序development,我一开始以为有点难,后来经过一点点的了解,发现微信小程序的开发和之前入门的HTML,CSS设计很像,也是前端的一部分吧。
找资源学习的第一节课,介绍第一个网址https://mp.weixin.qq.com,这个网址是微信小程序、小游戏开发的官方网站,微信开发软件也是在上面下载安装的。上面有框架,有很多的配置方法,开发绝对离不开它,你注册、管理也是在这个官网的。
1.首先笔记一下框架中的全局配置
配置示例
以下是一个包含了部分常用配置选项的 app.json :
{
"pages":[
"pages/index/index",
"pages/logs/logs"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#000",
"navigationBarTitleText": "WeChat666",
"navigationBarTextStyle":"white"
},
"tabBar": {
"color":"#fff",
"background":"#000",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath":"image/green_tri.png",
"selectedIconPath":"image/icon_API.png"
},
{
"pagePath": "pages/logs/logs",
"text": "日志",
"iconPath": "image/green_tri.png",
"selectedIconPath": "image/icon_API.png"
}
]
}
}
2.先介绍这几个配置,其他以后遇到再用
app.json 配置项列表
属性 类型 必填 描述
pages String Array 是 页面路径列表
window Object 否 全局的默认窗口表现
tabBar Object 否 底部 tab 栏的表现
networkTimeout Object 否 网络超时时间
debug Boolean 否 是否开启 debug 模式,默认关闭
3.pages
用于指定小程序由哪些页面组成,每一项都对应一个页面的 路径+文件名 信息。文件名不需要写文件后缀,框架会自动去寻找对于位置的 .json, .js, .wxml, .wxss 四个文件进行处理。
4.window
用于设置小程序的状态栏、导航条、标题、窗口背景色。
如 app.json :
{
"window":{
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "微信接口功能演示",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "light"
}
}
5.tabBar
如果小程序是一个多 tab 应用(客户端窗口的底部或顶部有 tab 栏可以切换页面),可以通过 tabBar 配置项指定 tab 栏的表现,以及 tab 切换时显示的对应页面。
"tabBar": {
"color":"#000",
"background":"#000",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath":"image/green_tri.png",
"selectedIconPath":"image/icon_API.png"
},
{
"pagePath": "pages/logs/logs",
"text": "日志",
"iconPath": "image/green_tri.png",
"selectedIconPath": "image/icon_API.png"
}
]
}
今天先入门,洗洗睡了。。。