cloud-web-corejs 1.0.331 → 1.0.332
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/package.json +1 -1
- package/src/utils/request.js +16 -0
- package/src/utils/vab.js +11 -1
package/package.json
CHANGED
package/src/utils/request.js
CHANGED
|
@@ -26,6 +26,18 @@ let configUtil = {
|
|
|
26
26
|
});
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
|
+
// 遮罩只能挂到真正的父节点上。Vue 注释占位、组件实例、选择器字符串都没有 append,
|
|
30
|
+
// 直接调用会在请求发出前抛错,并被错误拦截器弹成「e.loadingTarget.append is not a function」。
|
|
31
|
+
function resolveLoadingTarget(target) {
|
|
32
|
+
if (!target) return null;
|
|
33
|
+
if (target._isVue && target.$el) target = target.$el;
|
|
34
|
+
if (typeof target === "string" && typeof document !== "undefined") {
|
|
35
|
+
target = document.querySelector(target);
|
|
36
|
+
}
|
|
37
|
+
if (target && typeof target.append === "function") return target;
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
29
41
|
let service;
|
|
30
42
|
|
|
31
43
|
// create an axios instance
|
|
@@ -161,6 +173,10 @@ service.interceptors.request.use(
|
|
|
161
173
|
applyAesBody(config);
|
|
162
174
|
}
|
|
163
175
|
|
|
176
|
+
if (config.loadingTarget) {
|
|
177
|
+
config.loadingTarget = resolveLoadingTarget(config.loadingTarget);
|
|
178
|
+
}
|
|
179
|
+
|
|
164
180
|
if (config.modal !== false && config.loadingTarget) {
|
|
165
181
|
let zIndex = PopupManager.nextZIndex();
|
|
166
182
|
let pd = document.createElement("div");
|
package/src/utils/vab.js
CHANGED
|
@@ -11,6 +11,7 @@ import { getToken } from "./auth";
|
|
|
11
11
|
import XEUtils from "xe-utils";
|
|
12
12
|
|
|
13
13
|
import prefixConfig from "@/prefixConfig.js";
|
|
14
|
+
import settingConfig from "@/settings.js";
|
|
14
15
|
import moment from "moment";
|
|
15
16
|
import { openView } from "./repeatOpen";
|
|
16
17
|
import { assetUrl } from "./assetUrl";
|
|
@@ -217,7 +218,13 @@ install = (Vue, opts = {}) => {
|
|
|
217
218
|
/**http请求*/
|
|
218
219
|
let $http = async function (option) {
|
|
219
220
|
option = option || {};
|
|
220
|
-
if
|
|
221
|
+
// 根节点 v-if 为 false 时 $el 是注释占位,没有 append。传进去会在请求发出前抛错。
|
|
222
|
+
if (
|
|
223
|
+
!option.loadingTarget &&
|
|
224
|
+
this.$el &&
|
|
225
|
+
this.$el.nodeType === 1 &&
|
|
226
|
+
typeof this.$el.append === "function"
|
|
227
|
+
) {
|
|
221
228
|
option.loadingTarget = this.$el;
|
|
222
229
|
}
|
|
223
230
|
if (!option.vueTarget) {
|
|
@@ -1269,6 +1276,9 @@ install = (Vue, opts = {}) => {
|
|
|
1269
1276
|
};
|
|
1270
1277
|
|
|
1271
1278
|
Vue.prototype.$t2 = function (defaultValue, path, values) {
|
|
1279
|
+
if (settingConfig.t2ToT1Enabled === true) {
|
|
1280
|
+
return Vue.prototype.$t1.call(this, defaultValue, values);
|
|
1281
|
+
}
|
|
1272
1282
|
let that = window.$vueRoot;
|
|
1273
1283
|
if (!that.hasOwnProperty("_i18n")) {
|
|
1274
1284
|
return defaultValue;
|