uni-app manifest.json的h5设置影响mp-weixin
uni-app manifest.json的h5设置影响mp-weixin
开发环境 | 版本号 | 项目创建方式 |
---|---|---|
Mac | macOS 10.15.7 | CLI |
3.0.0-alpha-3040220220310001 | vite |
示例代码:
// mainfest.json
{
"h5": {
"router": {
"mode": "history",
"base": "match"
}
},
/* 小程序特有相关 */
"mp-weixin": {}
}
//小程序打包后代码,路径多了match导致引用的资源路径错误
<image src="/match/static/images/icon.png">
操作步骤:
看示例代码
预期结果:
//h5设置的router.base不应影响小程序打包的静态资源路径
<image src="/static/images/icon.png">
实际结果:
//小程序打包后代码,路径多了match导致引用的资源路径错误
<image src="/match/static/images/icon.png">
bug描述:
在mainfest.json设置
"h5": {
"router": {
"mode": "history",
"base": "match"
}
},
小程序打包后,静态资源引用也多了“match”
<image src="/match/static/images/icon.png">
更多关于uni-app manifest.json的h5设置影响mp-weixin的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
用相对路径 …/…/img.jpg 这种的
更多关于uni-app manifest.json的h5设置影响mp-weixin的实战教程也可以访问 https://www.itying.com/category-93-b0.html
import url from ‘@/static/images/icon.png’ 这种用相对路径也没用