perf: 优化应用参数

This commit is contained in:
kuaifan 2025-07-18 08:25:47 +08:00
parent b160021e67
commit 943941e0f6
3 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,7 @@
<iframe <iframe
ref="iframe" ref="iframe"
class="micro-app-iframe-container" class="micro-app-iframe-container"
:class="{'iframe-immersive': immersive}"
:src="src" :src="src"
sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox"> sandbox="allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox">
</iframe> </iframe>
@ -22,6 +23,11 @@
height: 100%; height: 100%;
padding-top: var(--status-bar-height); padding-top: var(--status-bar-height);
padding-bottom: var(--navigation-bar-height); padding-bottom: var(--navigation-bar-height);
&.iframe-immersive {
padding-top: 0;
padding-bottom: 0;
}
} }
.micro-app-iframe-cover { .micro-app-iframe-cover {
@ -49,6 +55,10 @@ export default {
data: { data: {
type: Object, type: Object,
default: null default: null
},
immersive: {
type: Boolean,
default: false
} }
}, },

View File

@ -16,6 +16,7 @@
:name="app.name" :name="app.name"
:url="app.url" :url="app.url"
:data="appData(app.name)" :data="appData(app.name)"
:immersive="app.iframe_immersive"
@mounted="mounted" @mounted="mounted"
@error="error"/> @error="error"/>
<micro-app <micro-app
@ -154,6 +155,7 @@ export default {
'userInfo', 'userInfo',
'themeName', 'themeName',
'microApps', 'microApps',
'safeAreaSize',
]), ]),
}, },
@ -228,6 +230,7 @@ export default {
languageList, languageList,
languageName, languageName,
themeName: this.themeName, themeName: this.themeName,
safeArea: this.safeAreaSize,
}, },
methods: { methods: {

View File

@ -4688,6 +4688,7 @@ export default {
* - disable_scope_css 是否禁用样式隔离 (true/false)默认 false * - disable_scope_css 是否禁用样式隔离 (true/false)默认 false
* - auto_dark_theme 是否自动适配深色主题 (true/false)默认 true * - auto_dark_theme 是否自动适配深色主题 (true/false)默认 true
* - keep_alive 是否开启微应用保活 (true/false)默认 true * - keep_alive 是否开启微应用保活 (true/false)默认 true
* - iframe_immersive 是否开启沉浸式模式仅在 url_type=iframe[_blank] 时有效 (true/false)默认 false
* - props 传递参数 * - props 传递参数
*/ */
async openMicroApp({state}, data) { async openMicroApp({state}, data) {
@ -4719,6 +4720,7 @@ export default {
disable_scope_css: typeof data.disable_scope_css == 'boolean' ? data.disable_scope_css : false, disable_scope_css: typeof data.disable_scope_css == 'boolean' ? data.disable_scope_css : false,
auto_dark_theme: typeof data.auto_dark_theme == 'boolean' ? data.auto_dark_theme : true, auto_dark_theme: typeof data.auto_dark_theme == 'boolean' ? data.auto_dark_theme : true,
keep_alive: typeof data.keep_alive == 'boolean' ? data.keep_alive : true, keep_alive: typeof data.keep_alive == 'boolean' ? data.keep_alive : true,
iframe_immersive: typeof data.iframe_immersive == 'boolean' ? data.iframe_immersive : false,
props: $A.isJson(data.props) ? data.props : {}, props: $A.isJson(data.props) ? data.props : {},
} }
if (!state.microAppsIds.includes(config.id)) { if (!state.microAppsIds.includes(config.id)) {