diff --git a/package.json b/package.json index 39e4691a53423e4b3ab65f34e8469d94b0d296ea..3a25d15477ddff7b5cf400d51789b990ef9874d4 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,8 @@ "my": true, "swan": true, "tt": true, - "qh": true, + "qh": true, + "qa": true, "weex": true, "__id__": true, "__uniConfig": true, diff --git a/src/platforms/h5/helpers/get-real-path.js b/src/platforms/h5/helpers/get-real-path.js index 0b018beca4426037c549aed50facf451b36c1aef..b8c611ce6d03c8679bec1222cd1989e0321c0c1e 100644 --- a/src/platforms/h5/helpers/get-real-path.js +++ b/src/platforms/h5/helpers/get-real-path.js @@ -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) {