提交 8b6a0e87 编写于 作者: fxy060608's avatar fxy060608

fix(h5): getRealPath compatible with template assets

上级 8b17b55f
......@@ -108,7 +108,8 @@
"my": true,
"swan": true,
"tt": true,
"qh": true,
"qh": true,
"qa": true,
"weex": true,
"__id__": true,
"__uniConfig": true,
......
......@@ -4,10 +4,17 @@ const SCHEME_RE = /^([a-z-]+:)?\/\//i
const DATA_RE = /^data:.*,.*/
function addBase (filePath) {
if (__uniConfig.router.base) {
return __uniConfig.router.base + filePath
const base = __uniConfig.router.base
if (!base) {
return filePath
}
return filePath
if (base !== '/') {
// 部分地址已经带了base(如被webpack处理过的资源自动带了publicPath)
if (('/' + filePath).indexOf(base) === 0) {
return '/' + filePath
}
}
return base + filePath
}
export default function getRealPath (filePath) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册