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

View File

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

View File

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