详细问题描述
在src/pages.json
文件中配置tabBar
时,如果iconPath
传入了一个相对路径或者是base64数据的时候,编译后的图片路径是错误的
重现步骤
[步骤]
`pages.json`
...
{
"tabBar": {
...
"list" : [
{
"pagePath": "pages/page1",
"iconPath": "./static/img/tabBar/iconA1.png",
"selectIconPath": "./static/img/tabBar/iconA2.png",
},
{
"pagePath": "pages/page2",
"iconPath": "data:image/png;base64,iVBORw0KGgoAxxxxxxx=",
"selectIconPath": "data:image/png;base64,iVBORw0KGgoAxxxxxxx=",
},
]
...
}
}
...
[结果]
使用上面的pages.json
中的tabBar配置,会导致编译出来的图片路径是错误的
- page1的icon路径:编译后的结果为
/./static/img/tabBar/iconA1.png
, 正确结果应为:./static/img/tabBar/iconA.png
- page1的icon路径:编译后的结果为
/data:image/png;base64,iVBORw0KGgoAxxxxxxx=
, 正确结果应为:data:image/png;base64,iVBORw0KGgoAxxxxxxx=
[期望]
期望能正确展示图片路径
uni-app运行环境说明
{
"@dcloudio/uni-app-plus": "^2.0.0-26920200409002",
"@dcloudio/uni-h5": "^2.0.0-26920200409002",
"@dcloudio/uni-helper-json": "*",
"@dcloudio/uni-mp-alipay": "^2.0.0-26920200409002",
"@dcloudio/uni-mp-baidu": "^2.0.0-26920200409002",
"@dcloudio/uni-mp-qq": "^2.0.0-26920200409002",
"@dcloudio/uni-mp-toutiao": "^2.0.0-26920200409002",
"@dcloudio/uni-mp-weixin": "^2.0.0-26920200409002",
"@dcloudio/uni-stat": "^2.0.0-26920200409002"
}
BUG 产生位置
@dcloudio\uni-h5\src\platforms\h5\components\app\tabBar.vue
第222-224
行
_getRealPath (filePath) {
// ↓↓↓↓↓ 多余的 ↓↓↓↓
if (filePath.indexOf('/') !== 0) {
filePath = '/' + filePath
}
// ↑↑↑↑↑ 多余的 ↑↑↑↑
return getRealPath(filePath)
},
联系方式
QQ:1026793188
1***@qq.com
我也没找到
2022-08-19 10:06