bl-common-vue3 3.8.123 → 3.8.124

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,6 +1,6 @@
1
1
  {
2
2
  "name": "bl-common-vue3",
3
- "version": "3.8.123",
3
+ "version": "3.8.124",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "description": "bailing vue3 common components lib",
@@ -39,10 +39,11 @@
39
39
  <script>
40
40
  import {
41
41
  computed,
42
- defineComponent, reactive, toRefs, watch,
42
+ defineComponent, getCurrentInstance, reactive, toRefs, watch,
43
43
  } from "vue";
44
44
  import {Modal, Table} from "ant-design-vue";
45
45
  import { SyncOutlined } from "@ant-design/icons-vue";
46
+ import { EventCenterForMicroApp } from "kj-micro-app";
46
47
  import {t, loadLanguageAsync} from "../../locale";
47
48
  import utils from "../../common/utils/util";
48
49
  import BlModal from "../BlModal/index.vue";
@@ -84,6 +85,7 @@ export default defineComponent({
84
85
  },
85
86
  },
86
87
  setup(props, { emit }) {
88
+ const instance = getCurrentInstance();
87
89
 
88
90
  const state = reactive({
89
91
  dataList: [], // 数据源
@@ -157,11 +159,17 @@ export default defineComponent({
157
159
  // context.emit("addProperty");
158
160
  state.addLoading = true;
159
161
  if (props.microMessageInfo.appName && props.microMessageInfo.routeName) {
160
- // 如果是在父应用中运行
162
+ // 共享依赖运行在主应用作用域,通过组件所属容器定位发起操作的子应用。
163
+ const rootElement = instance?.proxy?.$root?.$el;
164
+ const appElement = rootElement?.closest?.("micro-app") ||
165
+ rootElement?.parentElement?.closest("micro-app");
166
+ const appName = appElement?.getAttribute("name");
167
+ const microApp = typeof window.microApp?.forceDispatch === "function"
168
+ ? window.microApp
169
+ : appName ? new EventCenterForMicroApp(appName) : null;
161
170
 
162
- if (window.__MICRO_APP_ENVIRONMENT__) {
163
-
164
- window.microApp.forceDispatch({
171
+ if (microApp) {
172
+ microApp.forceDispatch({
165
173
  type: "SetChildDrawerList",
166
174
  info: {
167
175
  props: {