刚刚接触小程序,在设计tabBar的时候出现了问题。
原代码如下:
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#13227a",
"backgroundColor": "#ffffff",
"list": [
{"text": "汽车",
"pagePath":"pages/list/list",
"iconPath":"image/car.png",
"selectedIconPath":"image/car.png" },
{"text": "火车",
"iconPath":"image/train1.png",
"selectedIconPath":"image/train1.png" }
]
}
但是编译时会发生一下错误:
appJSON["tabBar"]["list"][1]["pagePath"] 字段需为string
这是由于微信开发者工具的一些小bug导致的原因,解决方案是在各个对象中的冒号后面加一个空格即可
"pagePath": "pages/list/list"