From a10bc74de1f2a624c752c78dd80fbdd8bd2de9da Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 4 Jul 2025 15:31:34 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=95=86=E5=9F=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 支持 background 参数 - iframe 模式添加安全距离 - iframe 支持 dootask/tools --- .../assets/js/components/MicroApps/iframe.vue | 47 +++++++++++++++++-- .../assets/js/components/MicroApps/index.vue | 6 +++ .../assets/js/components/MicroApps/modal.vue | 14 +++++- resources/assets/js/store/actions.js | 4 +- 4 files changed, 65 insertions(+), 6 deletions(-) diff --git a/resources/assets/js/components/MicroApps/iframe.vue b/resources/assets/js/components/MicroApps/iframe.vue index c9a8ae75d..29533844f 100644 --- a/resources/assets/js/components/MicroApps/iframe.vue +++ b/resources/assets/js/components/MicroApps/iframe.vue @@ -3,7 +3,8 @@ ref="iframe" class="micro-app-iframe" :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"> + \ No newline at end of file + diff --git a/resources/assets/js/components/MicroApps/index.vue b/resources/assets/js/components/MicroApps/index.vue index 4958c20a8..f061b3ea5 100644 --- a/resources/assets/js/components/MicroApps/index.vue +++ b/resources/assets/js/components/MicroApps/index.vue @@ -6,6 +6,7 @@ v-model="app.isOpen" :ref="`ref-${app.name}`" :size="1200" + :background="app.background" :transparent="app.transparent" :autoDarkTheme="app.auto_dark_theme" :beforeClose="async () => { await onBeforeClose(app.name) }"> @@ -13,6 +14,7 @@ v-if="app.url_type === 'iframe' && app.isOpen && app.url" :name="app.name" :url="app.url" + :data="appData(app.name)" @mounted="mounted" @error="error"/> -
+
@@ -50,6 +50,9 @@ export default { type: Number, default: 300 }, + background: { + default: null + }, transparent: { type: Boolean, default: false @@ -81,6 +84,15 @@ export default { } return ['micro-modal-fade', 'micro-modal-slide'] }, + bodyStyle() { + const styleObject = {} + if ($A.isJson(this.background)) { + styleObject.background = this.background + } else if (this.background) { + styleObject.backgroundColor = this.background; + } + return styleObject; + }, maskStyle({zIndex}) { return {zIndex} }, diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 2d7f2bc80..b8325df2e 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -4665,7 +4665,8 @@ export default { * - id 应用ID(必须) * - name 应用名称(必须) * - url 应用地址(必须) - * - url_type 地址类型 + * - url_type 地址类型(可选) + * - background 背景颜色(可选) * - transparent 是否透明模式 (true/false),默认 false * - disable_scope_css 是否禁用样式隔离 (true/false),默认 false * - auto_dark_theme 是否自动适配深色主题 (true/false),默认 true @@ -4695,6 +4696,7 @@ export default { name: data.name, url: $A.mainUrl(data.url), url_type: data.url_type || 'inline', + background: data.background || null, transparent: typeof data.transparent == 'boolean' ? data.transparent : 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,