@hzab/data-model 1.7.6 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/array-data-model.js +1 -2
- package/src/data-model.js +1 -0
- package/src/public-utils.js +7 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/array-data-model.js
CHANGED
|
@@ -397,8 +397,7 @@ class ArrayDataModel extends ArrayUtils {
|
|
|
397
397
|
// 是否使用 response.statusText 作为兜底 msg
|
|
398
398
|
useStatusText,
|
|
399
399
|
} = opt || {};
|
|
400
|
-
let message = (response.data && (response.data.message || response.data.msg)) || response.msg;
|
|
401
|
-
|
|
400
|
+
let message = (response.data && (response.data.message || response.data.msg)) || response.msg || response.message;
|
|
402
401
|
if (!message && useStatusText) {
|
|
403
402
|
message = response.statusText;
|
|
404
403
|
}
|
package/src/data-model.js
CHANGED
package/src/public-utils.js
CHANGED
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
* @param {*} url 文件路径
|
|
4
4
|
* @param {*} opt
|
|
5
5
|
*/
|
|
6
|
-
export function getPublicUrl(url, opt) {
|
|
6
|
+
export function getPublicUrl(url, opt = {}) {
|
|
7
7
|
if (typeof url !== "string") {
|
|
8
8
|
return url;
|
|
9
9
|
}
|
|
10
|
+
const { isFullPath } = opt || {};
|
|
10
11
|
let baseURL = (process.env.WEBPACK_PUBLIC_PATH || ".")?.replace(/^\//, "")?.replace(/\/$/, "");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
""
|
|
14
|
-
|
|
12
|
+
if (isFullPath) {
|
|
13
|
+
const fullPathname = (location.origin + location.pathname).replace(/[^\/]+.html\/?$/, "").replace(/\/$/, "");
|
|
14
|
+
return `${fullPathname}/${baseURL?.replace(/^\./, "")}/${url?.replace(/^\//, "")}`;
|
|
15
|
+
}
|
|
16
|
+
return `${baseURL}/${url?.replace(/^\//, "")}`;
|
|
15
17
|
}
|