no message

This commit is contained in:
kuaifan 2025-08-08 12:21:09 +08:00
parent 487c7e2824
commit b34fabab54
4 changed files with 20 additions and 37 deletions

View File

@ -10,7 +10,7 @@
:beforeClose="onBeforeClose" :beforeClose="onBeforeClose"
@on-capsule-more="onCapsuleMore" @on-capsule-more="onCapsuleMore"
@on-popout-window="onPopoutWindow" @on-popout-window="onPopoutWindow"
@on-close="closeMicroApp"> @on-confirm-close="closeMicroApp">
<MicroIFrame <MicroIFrame
v-if="shouldRenderIFrame(app)" v-if="shouldRenderIFrame(app)"
:name="app.name" :name="app.name"
@ -28,14 +28,14 @@
:data="appData(app.name)" :data="appData(app.name)"
@mounted="mounted" @mounted="mounted"
@error="error"/> @error="error"/>
</MicroModal>
<!--加载中--> <!--加载中-->
<transition name="fade"> <transition name="fade">
<div v-if="loadings.length > 0" class="micro-app-loader"> <div v-if="loadings.length > 0" class="micro-app-loader">
<Loading/> <Loading/>
</div> </div>
</transition> </transition>
</MicroModal>
<!--选择用户--> <!--选择用户-->
<UserSelect <UserSelect
@ -175,7 +175,6 @@ export default {
'themeName', 'themeName',
'microApps', 'microApps',
'safeAreaSize', 'safeAreaSize',
'windowIsMobileLayout',
]), ]),
}, },
@ -318,9 +317,6 @@ export default {
isFullScreen: () => { isFullScreen: () => {
return window.innerWidth < 768 || this.windowType === 'popout' return window.innerWidth < 768 || this.windowType === 'popout'
}, },
isMobileLayout: () => {
return this.windowIsMobileLayout
},
extraCallA: (...args) => { extraCallA: (...args) => {
if (args.length > 0 && typeof args[0] === 'string') { if (args.length > 0 && typeof args[0] === 'string') {
const methodName = args[0]; const methodName = args[0];
@ -543,10 +539,9 @@ export default {
/** /**
* 关闭之前判断 * 关闭之前判断
* @param name * @param name
* @param {boolean} auto 当等于 true 并且是 keep_alive 的应用则不执行 onBeforeClose
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
onBeforeClose(name, auto = false) { onBeforeClose(name) {
return new Promise(resolve => { return new Promise(resolve => {
const onClose = () => { const onClose = () => {
if ($A.isSubElectron) { if ($A.isSubElectron) {
@ -562,11 +557,6 @@ export default {
onClose() onClose()
return return
} }
if (auto && app.keep_alive) {
// auto keep_alive onBeforeClose
onClose()
return
}
if (this.isIframe(app.url_type)) { if (this.isIframe(app.url_type)) {
const before = app.onBeforeClose(); const before = app.onBeforeClose();
@ -621,6 +611,10 @@ export default {
this.onRestartApp(name) this.onRestartApp(name)
break; break;
case "destroy":
this.closeMicroApp(name, true)
break;
default: default:
const app = this.microApps.find(item => item.name == name); const app = this.microApps.find(item => item.name == name);
if (!app) { if (!app) {

View File

@ -2,7 +2,7 @@
<div v-transfer-dom :data-transfer="true"> <div v-transfer-dom :data-transfer="true">
<div :class="className"> <div :class="className">
<transition :name="transitions[0]"> <transition :name="transitions[0]">
<div v-if="shouldRenderInDom" v-show="open" class="micro-modal-mask" @click="onClose(false)" :style="maskStyle"></div> <div v-if="shouldRenderInDom" v-show="open" class="micro-modal-mask" :style="maskStyle"></div>
</transition> </transition>
<transition :name="transitions[1]"> <transition :name="transitions[1]">
<div v-if="shouldRenderInDom" v-show="open" class="micro-modal-content" :style="contentStyle"> <div v-if="shouldRenderInDom" v-show="open" class="micro-modal-content" :style="contentStyle">
@ -17,7 +17,7 @@
</svg> </svg>
</div> </div>
<div class="micro-modal-capsule-line"></div> <div class="micro-modal-capsule-line"></div>
<div class="micro-modal-capsule-item" @click="onClose(false)"> <div class="micro-modal-capsule-item" @click="onCapsuleClose">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9 16C12.866 16 16 12.866 16 9C16 5.13401 12.866 2 9 2C5.13401 2 2 5.13401 2 9C2 12.866 5.13401 16 9 16Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M9 16C12.866 16 16 12.866 16 9C16 5.13401 12.866 2 9 2C5.13401 2 2 5.13401 2 9C2 12.866 5.13401 16 9 16Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9 12C10.6569 12 12 10.6569 12 9C12 7.34315 10.6569 6 9 6C7.34315 6 6 7.34315 6 9C6 10.6569 7.34315 12 9 12Z" fill="currentColor"/> <path d="M9 12C10.6569 12 12 10.6569 12 9C12 7.34315 10.6569 6 9 6C7.34315 6 6 7.34315 6 9C6 10.6569 7.34315 12 9 12Z" fill="currentColor"/>
@ -82,7 +82,6 @@ export default {
} }
}, },
computed: { computed: {
...mapState(['windowIsMobileLayout']),
shouldRenderInDom() { shouldRenderInDom() {
return this.open || !!this.options.keep_alive; return this.open || !!this.options.keep_alive;
}, },
@ -92,7 +91,6 @@ export default {
'micro-modal-hidden': !this.open, 'micro-modal-hidden': !this.open,
'no-dark-content': !this.options.auto_dark_theme, 'no-dark-content': !this.options.auto_dark_theme,
'transparent-mode': !!this.options.transparent, 'transparent-mode': !!this.options.transparent,
'capsule-mode': this.windowIsMobileLayout,
} }
}, },
transitions() { transitions() {
@ -185,7 +183,7 @@ export default {
} }
const systemMenu = [ const systemMenu = [
{label: this.$L('重启应用'), value: 'restart'}, {label: this.$L('重启应用'), value: 'restart'},
{label: this.$L('关闭应用'), value: 'close'}, {label: this.$L('关闭应用'), value: 'destroy'},
]; ];
if ($A.isMainElectron) { if ($A.isMainElectron) {
systemMenu.unshift({label: this.$L('新窗口打开'), value: 'popout'}) systemMenu.unshift({label: this.$L('新窗口打开'), value: 'popout'})
@ -201,20 +199,16 @@ export default {
this.capsuleMenuShow = visible; this.capsuleMenuShow = visible;
}, },
onUpdate: (value) => { onUpdate: (value) => {
if (value === 'close') { this.$emit('on-capsule-more', this.options.name, value);
this.onClose(true);
} else {
this.$emit('on-capsule-more', this.options.name, value);
}
} }
}) })
}, },
onClose(auto = false) { onCapsuleClose() {
if (!this.beforeClose) { if (!this.beforeClose) {
return this.handleClose(); return this.handleClose();
} }
const before = this.beforeClose(this.options.name, auto); const before = this.beforeClose(this.options.name);
if (before && before.then) { if (before && before.then) {
before.then(() => { before.then(() => {
this.handleClose(); this.handleClose();
@ -225,7 +219,7 @@ export default {
}, },
handleClose() { handleClose() {
this.$emit('on-close', this.options.name); this.$emit('on-confirm-close', this.options.name);
} }
} }
} }

View File

@ -29,8 +29,6 @@ export default {
state.windowIsFullScreen = $A.isFullScreen() state.windowIsFullScreen = $A.isFullScreen()
state.windowIsMobileLayout = windowWidth < 768 || state.windowTouch
state.formOptions = { state.formOptions = {
class: windowWidth > 576 ? '' : 'form-label-weight-bold', class: windowWidth > 576 ? '' : 'form-label-weight-bold',
labelPosition: windowWidth > 576 ? 'right' : 'top', labelPosition: windowWidth > 576 ? 'right' : 'top',

View File

@ -40,9 +40,6 @@ export default {
// 是否全屏 // 是否全屏
windowIsFullScreen: windowIsFullScreen, windowIsFullScreen: windowIsFullScreen,
// 是否移动端布局
windowIsMobileLayout: windowWidth < 768 || ("ontouchend" in document),
// 表单布局 // 表单布局
formOptions: { formOptions: {
class: windowWidth > 576 ? '' : 'form-label-weight-bold', class: windowWidth > 576 ? '' : 'form-label-weight-bold',