From 25582530b2dca67ffdfed42b633db83be331c604 Mon Sep 17 00:00:00 2001 From: ShineKOT <1917095344@qq.com> Date: Wed, 26 Feb 2025 11:56:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=20=E6=9B=B4=E6=96=B0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E6=A0=87=E7=AD=BE=E9=A1=B5=E6=A0=87?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/global-util-design/src/index.ts | 2 ++ .../src/platform/browser-platform-provider.ts | 36 +++++++++++++++++++ .../global-util-design/src/platform/index.ts | 16 +++++++++ 3 files changed, 54 insertions(+) create mode 100644 packages/global-util-design/src/platform/browser-platform-provider.ts create mode 100644 packages/global-util-design/src/platform/index.ts diff --git a/packages/global-util-design/src/index.ts b/packages/global-util-design/src/index.ts index 93d5e75f..d22ddabb 100644 --- a/packages/global-util-design/src/index.ts +++ b/packages/global-util-design/src/index.ts @@ -1,9 +1,11 @@ import { App } from 'vue'; import Views from './views'; +import Platform from './platform'; import './style/index.scss'; export default { install(app: App): void { app.use(Views); + app.use(Platform); }, }; diff --git a/packages/global-util-design/src/platform/browser-platform-provider.ts b/packages/global-util-design/src/platform/browser-platform-provider.ts new file mode 100644 index 00000000..0caa1746 --- /dev/null +++ b/packages/global-util-design/src/platform/browser-platform-provider.ts @@ -0,0 +1,36 @@ +import { PlatformProviderBase } from '@ibiz-template/runtime'; + +/** + * 浏览器搭载平台适配器 + * + * @author zk + * @date 2023-11-20 03:11:25 + * @export + * @class BrowserPlatformProvider + * @extends {PlatformProviderBase} + */ +export class BrowserPlatformProvider extends PlatformProviderBase { + /** + * 设置浏览器标签页标题 + * + * @param {string} title + * @memberof BrowserPlatformProvider + */ + setBrowserTitle(_title: string): void { + const app = ibiz.hub.getApp(); + const appContext = ibiz.appData?.context; + let tabTitle: string = ''; + if (ibiz.env.AppLabel) { + tabTitle = ibiz.env.AppLabel; + } else if (app.model.title) { + tabTitle = app.model.title; + } else { + tabTitle = this.sourceTitle; + } + if (appContext?.srfpssyslogicname) + tabTitle += ` - ${appContext.srfpssyslogicname}${ + appContext.srfpssysname ? ` (${appContext.srfpssysname})` : '' + }`; + document.title = tabTitle; + } +} diff --git a/packages/global-util-design/src/platform/index.ts b/packages/global-util-design/src/platform/index.ts new file mode 100644 index 00000000..57b1b3c2 --- /dev/null +++ b/packages/global-util-design/src/platform/index.ts @@ -0,0 +1,16 @@ +import { + PlatformType, + getPlatformProvider, + registerPlatformProvider, +} from '@ibiz-template/runtime'; +import { BrowserPlatformProvider } from './browser-platform-provider'; + +export default { + install(): void { + registerPlatformProvider( + PlatformType.BROWSER, + () => new BrowserPlatformProvider(), + ); + ibiz.platform = getPlatformProvider(); + }, +}; -- Gitee