cloud-web-corejs 1.0.330 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.330",
4
+ "version": "1.0.332",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "check:package-resources": "node build/check-package-resources.js",
package/src/utils/aes.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import request from "./request.js";
2
2
  import CryptoJS from "crypto-js";
3
- import prefixConfig from "@base/prefixConfig.js";
3
+ import prefixConfig from "@/prefixConfig.js";
4
4
  import { getToken } from "./auth.js";
5
5
 
6
6
  // 密钥只存在内存里,跟当前 token 绑定。退出登录或 token 变化后作废。
@@ -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 (!option.loadingTarget && this.$el) {
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;