当我开发微信小程序时,并使用uni-app开发过程中,发现在page.json页出现一个问题。
当我使用rpx和rem等相对像素描述长度时,在微信开发工具上面无法得到正确的结果,而在网页上则可以。
page页的代码如下,我只写一点。
```javascript
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "津浙职通车"
}
},
{
"path":"pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
},{
"path": "pages/my/userCenter",
"style": {
"navigationBarTitleText": "用户中心"
},
"needLogin": true
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "津浙职通车",
"navigationBarBackgroundColor": "#EBECED",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {},
"tabBar": {
"selectedColor": "#4FB5AC",
"color": "black",
"height": "144.23rpx",
"fontSize": "34.62rpx",
"iconWidth": "71.15rpx",
"list": [
{
"pagePath": "pages/index/index",
"text": "职位",
"iconPath": "static/tarBar/bag.png",
"selectedIconPath": "static/tarBar/bag2.png"
},{
"pagePath": "pages/my/userCenter",
"text": "我的",
"iconPath": "static/tarBar/user.png",
"selectedIconPath": "static/tarBar/user2.png"
}
]
}
}
结果的图片如下,左边是网页,右边是小程序的模拟结果
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/437077451896125.png "#left")