From fe75cffbf3bae6777aa2794fd89fa5dc37f5df8d Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 七月 2025 10:11:23 +0800
Subject: [PATCH] 项目初始化

---
 src/directive/common/full.ts |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/src/directive/common/full.ts b/src/directive/common/full.ts
new file mode 100644
index 0000000..45378dd
--- /dev/null
+++ b/src/directive/common/full.ts
@@ -0,0 +1,50 @@
+import type { Directive } from "vue";
+interface ElType extends HTMLElement {
+    $oldStyle: CSSStyleDeclaration;
+    $fullStyle: CSSStyleDeclaration;
+}
+const vFull: Directive = {
+    mounted: (el: ElType, binding) => {
+        el.$oldStyle = { ...el.style }
+        if (binding.arg === 'screen') {
+            el.$fullStyle = {
+                ...el.style,
+                left: '0',
+                top: '0',
+                zIndex: '8',
+                position: 'fixed',
+                height: '100vh',
+                width: '100vw',
+            }
+        } else {
+            el.$fullStyle = {
+                ...el.style,
+                left: '0',
+                top: '0',
+                zIndex: '8',
+                position: 'absolute',
+                height: '100%',
+                width: '100%',
+            }
+        }
+
+    },
+    updated: (el: ElType, binding) => {
+        function setStyle(el: CSSStyleDeclaration, style: CSSStyleDeclaration) {
+            el.position = style.position
+            el.left = style.left
+            el.top = style.top
+            el.zIndex = style.zIndex
+            el.height = style.height
+            el.width = style.width
+        }
+        if (binding.value) {
+            setStyle(el.style, el.$fullStyle)
+        } else {
+            setStyle(el.style, el.$oldStyle)
+        }
+    }
+}
+export default vFull
+
+

--
Gitblit v1.9.3