no message

This commit is contained in:
kuaifan 2025-05-07 08:27:22 +08:00
parent a608734be9
commit f53a5ea6c1
2 changed files with 37 additions and 67 deletions

View File

@ -1,28 +1,38 @@
<template> <template>
<div
v-if="appConfig.transparent"
v-transfer-dom
:data-transfer="true">
<micro-app
v-if="appConfig.isOpen"
:name="appConfig.appName"
:url="appConfig.appUrl"
:keep-alive="appConfig.keepAlive"
:data="appData"
@created="created"
@beforemount="beforemount"
@mounted="mounted"
@unmount="unmount"
@error="error"/>
</div>
<DrawerOverlay <DrawerOverlay
ref="drawer" v-else
v-model="appConfig.isOpen" v-model="appConfig.isOpen"
modal-class="micro-app-modal"
drawer-class="micro-app-drawer"
placement="right" placement="right"
:modal-class="modalClass"
:drawer-class="drawerClass"
:transitions="transitions"
:force-fullscreen="appConfig.forceFullscreen"
:size="1200"> :size="1200">
<div v-if="appConfig.isOpen" class="micro-app-wrapper"> <micro-app
<micro-app v-if="appConfig.isOpen"
:name="appConfig.appName" :name="appConfig.appName"
:url="appConfig.appUrl" :url="appConfig.appUrl"
:keep-alive="appConfig.keepAlive" :keep-alive="appConfig.keepAlive"
:data="appData" :data="appData"
@created="created" @created="created"
@beforemount="beforemount" @beforemount="beforemount"
@mounted="mounted" @mounted="mounted"
@unmount="unmount" @unmount="unmount"
@error="error"/> @error="error"/>
<div v-if="loadIng > 0" class="micro-app-load">
<Loading/>
</div>
</div>
</DrawerOverlay> </DrawerOverlay>
</template> </template>
@ -38,31 +48,6 @@
overflow: hidden; overflow: hidden;
} }
} }
.micro-app-transparent {
.ivu-modal,
.ivu-modal-content {
background: transparent;
}
.overlay-body {
.overlay-content {
background: transparent;
}
}
}
.micro-app-wrapper {
.micro-app-load {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
align-items: center;
display: flex;
justify-content: center;
}
}
</style> </style>
<script> <script>
@ -76,16 +61,17 @@ import {languageList, languageName} from "../language";
import {DatePicker} from 'view-design-hi'; import {DatePicker} from 'view-design-hi';
import DrawerOverlay from "./DrawerOverlay/index.vue"; import DrawerOverlay from "./DrawerOverlay/index.vue";
import emitter from "../store/events"; import emitter from "../store/events";
import TransferDom from "../directives/transfer-dom";
const appMaps = new Map(); const appMaps = new Map();
export default { export default {
name: "MicroApps", name: "MicroApps",
directives: {TransferDom},
components: {DrawerOverlay}, components: {DrawerOverlay},
data() { data() {
return { return {
loadIng: 0,
appConfig: {}, appConfig: {},
} }
}, },
@ -117,18 +103,6 @@ export default {
'themeName', 'themeName',
]), ]),
modalClass() {
return this.appConfig.transparent ? 'micro-app-modal micro-app-transparent' : 'micro-app-modal'
},
drawerClass() {
return this.appConfig.transparent ? 'micro-app-drawer micro-app-transparent' : 'micro-app-drawer'
},
transitions() {
return this.appConfig.transparent ? ['', ''] : []
},
appData() { appData() {
const {initialData, appName} = this.appConfig; const {initialData, appName} = this.appConfig;
@ -168,11 +142,9 @@ export default {
}, },
handleClose: (destroy = false) => { handleClose: (destroy = false) => {
this.$refs.drawer.onClose(); this.appConfig.appName === appName && (this.appConfig.isOpen = false);
if (destroy) { if (destroy) {
setTimeout(_ => { microApp.unmountApp(appName, {destroy: true})
microApp.unmountApp(appName, {destroy: true})
}, 301)
} }
}, },
@ -202,7 +174,7 @@ export default {
created(e) { created(e) {
const item = appMaps.get(e.detail.name) const item = appMaps.get(e.detail.name)
if (item?.isLoading) { if (item?.isLoading) {
this.loadIng++ this.$store.dispatch('showSpinner');
} }
}, },
@ -210,7 +182,7 @@ export default {
beforemount(e) { beforemount(e) {
const item = appMaps.get(e.detail.name) const item = appMaps.get(e.detail.name)
if (item?.isLoading) { if (item?.isLoading) {
this.loadIng-- this.$store.dispatch('hiddenSpinner');
} }
}, },
@ -237,8 +209,7 @@ export default {
appUrl: null, // URL appUrl: null, // URL
initialData: {}, // initialData: {}, //
forceFullscreen: false, // (true/false) transparent: false, // (true/false)
transparent: false, // (true/false)
keepAlive: true, // (true/false) keepAlive: true, // (true/false)
isLoading: true, // (true/false) isLoading: true, // (true/false)

View File

@ -4677,7 +4677,6 @@ export default {
type: 'details', type: 'details',
id: value, id: value,
}, },
forceFullscreen: true,
transparent: true, transparent: true,
}); });
} else { } else {