diff --git a/resources/assets/js/components/MicroApps/index.vue b/resources/assets/js/components/MicroApps/index.vue index 6439d07f2..e09e1a3b3 100644 --- a/resources/assets/js/components/MicroApps/index.vue +++ b/resources/assets/js/components/MicroApps/index.vue @@ -404,6 +404,9 @@ export default { } } + // 解析 type 字段 + config.type = this.resolveType(config.type) + // 如果是 blank 链接,则在新窗口打开 if (/_blank$/i.test(config.type)) { await this.inlineBlank(config) @@ -769,6 +772,25 @@ export default { this.closeMicroApp(app.name, true) } }) + }, + + /** + * 解析类型 + * @param type + */ + resolveType(type) { + if (typeof type === 'string') { + return type + } + if ($A.isJson(type)) { + const defaultType = typeof type.default === 'string' ? type.default : 'iframe' + const mobileType = typeof type.mobile === 'string' + ? type.mobile + : (typeof type.app === 'string' ? type.app : defaultType) + const desktopType = typeof type.desktop === 'string' ? type.desktop : defaultType + return $A.platformType() === 'desktop' ? desktopType : mobileType + } + return 'inline' } } } diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index a9e9eda75..9ffef0ce7 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -5095,26 +5095,11 @@ export default { }) .replace(/\{system_base_url}/g, serverLocation.origin) - const resolveType = () => { - if (typeof data.type === 'string') { - return data.type - } - if ($A.isJson(data.type)) { - const defaultType = typeof data.type.default === 'string' ? data.type.default : 'iframe' - const mobileType = typeof data.type.mobile === 'string' - ? data.type.mobile - : (typeof data.type.app === 'string' ? data.type.app : defaultType) - const desktopType = typeof data.type.desktop === 'string' ? data.type.desktop : defaultType - return $A.platformType() === 'desktop' ? desktopType : mobileType - } - return 'inline' - } - const config = { id: data.id, name: data.name, url: $A.mainUrl(data.url), - type: resolveType(), + type: data.type || data.url_type, background: data.background || null, capsule: $A.isJson(data.capsule) ? data.capsule : {}, transparent: typeof data.transparent == 'boolean' ? data.transparent : false,