7***@qq.com
7***@qq.com
  • 发布:2024-06-28 16:47
  • 更新:2024-06-28 17:08
  • 阅读:98

【报Bug】支付宝小程序tabbar图标问题,报pages.json解析失败,不符合 json 规范

分类:uni-app

产品分类: uniapp/小程序/阿里

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win 10

HBuilderX类型: 正式

HBuilderX版本号: 4.15

第三方开发者工具版本号: 3.8.21.0

基础库版本号: 2.9.12

项目创建方式: HBuilderX

示例代码:

{
// 如果您是通过uni_modules形式引入uView,可以忽略此配置
"easycom": {
"^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue"
},
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationBarHidden": true, // 关键:隐藏导航栏
"disableScroll": false // 根据需要设置,避免内容滚动到顶部时触发导航栏显示
}
}, {
"path": "pages/my/my",
"style": {}
}, {
"path": "pages/my/bill",
"style": {}
}, {
"path": "pages/my/service",
"style": {}
}, {
"path": "pages/my/reading",
"style": {}
}, {
"path": "pages/door/door",
"style": {}
}
],
"subPackages": [{
"root": "pages_A", //子包的根目录
"pages": [{
"path": "apply/apply",
"style": {}

        }, {  
            "path": "billDetails/billDetails",  
            "style": {}  
        }, {  
            "path": "billDetails/electronicBill",  
            "style": {}  

        }, {  
            "path": "family/family",  
            "style": {}  
        }, {  
            "path": "identity/identity",  
            "style": {}  

        }, {  
            "path": "owner/owner",  
            "style": {}  

        }, {  
            "path": "owner/ownerType",  
            "style": {}  
        }, {  
            "path": "owner/workOrder",  
            "style": {}  
        }, {  
            "path": "owner/ownerOrder",  
            "style": {}  
        },  
        {  
            "path": "feedback/feedback",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        }  
    ]  
}, {  
    "root": "pages_B", //子包的根目录  
    "pages": [{  
            "path": "pay/pay",  
            "style": {}  

        }, {  
            "path": "pay/payDetails",  
            "style": {}  
        }, {  
            "path": "pay/payment",  
            "style": {}  

        }, {  
            "path": "property/property",  
            "style": {}  
        }, {  
            "path": "property/pending/pending",  
            "style": {}  

        }, {  
            "path": "property/process/process",  
            "style": {}  
        }, {  
            "path": "property/completed/completed",  
            "style": {}  
        }, {  
            "path": "property/subordinate/subordinate",  
            "style": {}  
        }, {  
            "path": "property/propertyOrder",  
            "style": {}  
        }, {  
            "path": "propose/propose",  
            "style": {}  
        }, {  
            "path": "setUp/setUp",  
            "style": {}  

        }, {  
            "path": "setUp/register",  
            "style": {}  
        }, {  
            "path": "setUp/changePhone",  
            "style": {}  
        }, {  
            "path": "vote/vote",  
            "style": {}  
        }, {  
            "path": "vote/myVote",  
            "style": {}  
        }, {  
            "path": "vote/voteDetail",  
            "style": {}  
        }, {  
            "path": "waterAndPower/power",  
            "style": {}  
        }, {  
            "path": "waterAndPower/water",  
            "style": {}  
        }, {  
            "path": "waterAndPower/poolPower",  
            "style": {}  
        }, {  
            "path": "waterAndPower/poolWater",  
            "style": {}  
        }, {  
            "path": "waterAndPower/powerMeter",  
            "style": {}  
        }, {  
            "path": "waterAndPower/waterMeter",  
            "style": {}  
        }, {  
            "path": "webView/webView",  
            "style": {  
                "navigationBarTitleText": "巧科粒智慧物业",  
                "enablePullDownRefresh": false,  
                "navigationStyle": "default"  
            }  
        }, {  
            "path": "login/login",  
            "style": {}  
        }, {  
            "path": "notice/notice",  
            "style": {}  
        }, {  
            "path": "notice/noticeDetails",  
            "style": {}  
        }, {  
            "path": "notice/addNotice",  
            "style": {}  
        },  
        {  
            "path": "workPay/workCheckPay",  
            "style": {}  
        },  
        {  
            "path": "workPay/scanCodePay",  
            "style": {}  
        },  
        {  
            "path": "workPay/workPay",  
            "style": {}  
        },  
        {  
            "path": "workPay/payStatus",  
            "style": {  
                "navigationBarTitleText": ""  
            }  
        },  
        {  
            "path": "workPay/editRoom",  
            "style": {  
                "navigationBarTitleText": ""  
            }  
        }  
    ]  
}, {  
    "root": "pages_vehicle",  
    "pages": [{  
        "path": "addCar/addCar",  
        "style": {}  

    }, {  
        "path": "cardList/cardList",  
        "style": {}  

    }, {  
        "path": "renew/renew",  
        "style": {}  

    }, {  
        "path": "apply/apply",  
        "style": {}  

    }, {  
        "path": "apply/examine",  
        "style": {}  

    }, {  
        "path": "bill/bill",  
        "style": {}  

    }, {  
        "path": "temporaryParking/temporaryParking",  
        "style": {}  

    }, {  
        "path": "temporaryParking/parkingInfo",  
        "style": {}  

    }]  
}, {  
    "root": "pages_shop",  
    "pages": [{  
            "path": "index/index",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        },  
        {  
            "path": "my/my",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        },  
        {  
            "path": "goods/goods",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        },  
        {  
            "path": "order/order",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        },  
        {  
            "path": "payment/onlinePayment",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        },  
        {  
            "path": "payment/payment",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        },  
        {  
            "path": "order/orderDetails",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        },  
        {  
            "path": "address/address",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        },  
        {  
            "path": "address/addAddress/addAddress",  
            "style": {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": false  
            }  
        }  
    ]  
}],  
"globalStyle": {  
    "navigationBarTextStyle": "transparent",  
    "navigationBarBackgroundColor": "transparent",  
    "backgroundColor": "#F8F8F8",  
    "navigationStyle": "custom", // 设置导航栏风格为自定义  
    "navigationBarTitleText": "",  
    // 注意:全局配置可能不会直接作用于隐藏返回按钮,主要配置还需在页面级完成  
    "mp-alipay": {  
        "transparentTitle": "always", // 使标题区域透明  
        "titlePenetrate": "YES" // 允许内容穿透标题区域  
    }  
},  
"tabBar": {  
    "color": "#202020",  
    "selectedColor": "#2896EC",  
    "list": [{  
        "pagePath": "pages/index/index",  
        "text": "首页",  
        "iconPath": "static/tabbar/index.png",  
        "selectedIconPath   ": "static/tabbar/index_active.png"  
    }, {  
        "pagePath": "pages/my/my",  
        "text": "我的",  
        "iconPath": "static/tabbar/my.png",  
        "selectedIconPath   ": "static/tabbar/my_active.png"  
    }]  
}  

}

操作步骤:

编译报错

预期结果:

...

实际结果:

编译报错

17:10:10.164 项目 remoteControlAli 开始编译
17:10:11.332 Error: pages.json解析失败,不符合 json 规范
17:10:11.332 Unexpected token in JSON at position 6088
17:10:11.332 at getJson (D:\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\uni-cli-shared\lib\json.js:35:11)
17:10:11.332 at getPagesJson (D:\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\uni-cli-shared\lib\pages.js:39:27)
17:10:11.332 at Object.<anonymous> (D:\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\vue-cli-plugin-uni\lib\env.js:235:22)
17:10:11.332 at Module._compile (node:internal/modules/cjs/loader:1364:14)
17:10:11.332 at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
17:10:11.333 at Module.load (node:internal/modules/cjs/loader:1203:32)
17:10:11.333 at Module._load (node:internal/modules/cjs/loader:1019:12)
17:10:11.333 at Module.require (node:internal/modules/cjs/loader:1231:19)
17:10:11.333 at require (node:internal/modules/helpers:177:18)
17:10:11.333 at Object.<anonymous> (D:\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\vue-cli-plugin-uni\index.js:21:5)
17:10:11.467 Error: getaddrinfo ENOTFOUND 96f0e031-f37a-48ef-84c7-2023f6360c0a.bspapp.com
17:10:11.467 at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
17:10:11.467 errno: -3008,
17:10:11.467 code: 'ENOTFOUND',
17:10:11.467 syscall: 'getaddrinfo',
17:10:11.467 hostname: '96f0e031-f37a-48ef-84c7-2023f6360c0a.bspapp.com'
17:10:11.467 }

bug描述:

按照HB文档填写tabbar报错
Error: pages.json解析失败,不符合 json 规范

如不填写iconPath,selectedIconPath,可以正常编译,但是没有图标,不满足开发需求

2024-06-28 16:47 负责人:无 分享
已邀请:
DCloud_UNI_yuhe

DCloud_UNI_yuhe

经过测试,暂时没有发现问题,请你再检查一下代码,或者给我们提供更多的信息

  • 7***@qq.com (作者)

    已解决,发现多了个空格

    2024-06-28 17:26

要回复问题请先登录注册