From 8fd6f6ae2a12d11a72df5643e90220701717d472 Mon Sep 17 00:00:00 2001 From: lijisanxiong <1518062161@qq.com> Date: Thu, 21 Aug 2025 09:37:18 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=B0=B4?= =?UTF-8?q?=E5=8D=B0=E5=B7=A5=E5=85=B7=E7=B1=BB=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=B0=B4=E5=8D=B0=E6=8C=82=E8=BD=BD=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A7=86=E5=9B=BE=E6=B0=B4=E5=8D=B0=E6=8C=82?= =?UTF-8?q?=E8=BD=BD=E3=80=82=E6=96=B0=E5=A2=9E=E5=BA=94=E7=94=A8=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=8F=82=E6=95=B0watermark=EF=BC=88=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=A7=86=E5=9B=BE=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=8F=82=E6=95=B0waterMarkOption=EF=BC=88=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E8=A7=86=E5=9B=BE=E9=BB=98=E8=AE=A4=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=A4=BA=E4=BE=8B=EF=BC=9AwaterMarkOption=3D?= =?UTF-8?q?{"enable":true,"text":"=E7=A4=BA=E4=BE=8B=E7=B3=BB=E7=BB=9F"}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + src/web-app/App.tsx | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f79f7891..54e4feb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Added - 第三方登录组件支持通过自定义补充参数指定需要展示的第三方登录方式 +- 新增水印工具类,新增应用水印挂载,新增视图水印挂载。新增应用全局参数watermark(应用水印配置参数),新增视图默认参数waterMarkOption(视图水印配置参数),视图默认参数配置示例:waterMarkOption={"enable":true,"text":"示例系统"} ## Fixed diff --git a/src/web-app/App.tsx b/src/web-app/App.tsx index 2f0b0387..d2d163b3 100644 --- a/src/web-app/App.tsx +++ b/src/web-app/App.tsx @@ -1,4 +1,10 @@ -import { defineComponent, onUnmounted } from 'vue'; +import { + defineComponent, + onUnmounted, + onMounted, + onBeforeUnmount, + nextTick, +} from 'vue'; import { Modal, ViewMode } from '@ibiz-template/runtime'; import { AppHooks } from '@ibiz-template/vue3-util'; import './App.scss'; @@ -21,6 +27,22 @@ export default defineComponent({ // 页面关闭 window.addEventListener('unload', destroyAppHub); + // 水印销毁方法 + let watermarkDestroy: () => void; + onMounted(() => { + nextTick(() => { + const { watermark } = ibiz.config; + if (!watermark.enable) return; + + // 挂载视图水印 + watermarkDestroy = ibiz.util.watermark.mount(watermark); + }); + }); + + onBeforeUnmount(() => { + watermarkDestroy?.(); + }); + // 页面卸载 onUnmounted(() => { destroyAppHub(); -- Gitee