npmapps 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,2 +1,3 @@
1
1
  1.0.0 VSCodeUserSetup-x64-1.96.4.exe
2
- 1.0.1 HeidiSQL_12.10.0.7000_Setup.7z
2
+ 1.0.1 HeidiSQL_12.10.0.7000_Setup.7z
3
+ 1.0.2 v-fullScreen.browser.text
@@ -0,0 +1,114 @@
1
+ {
2
+ bind(el, binding) {
3
+ el.style.position = 'relative';
4
+ let originalBgColor = window.getComputedStyle(el).backgroundColor || '#fff';
5
+ let isMaximized = false;
6
+ let originalStyles = {};
7
+
8
+ // 创建按钮
9
+ const btn = document.createElement('i');
10
+ btn.style.cssText = `
11
+ position: absolute;
12
+ top: 10px;
13
+ right: 10px;
14
+ cursor: pointer;
15
+ font-size: 20px;
16
+ color: #409EFF;
17
+ z-index: 1000;
18
+ `;
19
+
20
+ if (binding.modifiers.browser) {
21
+ // 浏览器内全屏模式
22
+ btn.className = 'el-icon-full-screen';
23
+
24
+ // 退出全屏的函数
25
+ const exitFullScreen = () => {
26
+ if (isMaximized) {
27
+ // 恢复原始样式
28
+ Object.assign(el.style, originalStyles);
29
+ btn.className = 'el-icon-full-screen';
30
+ isMaximized = false;
31
+ }
32
+ };
33
+
34
+ // 监听ESC键
35
+ document.addEventListener('keydown', (e) => {
36
+ if (e.key === 'Escape' && isMaximized) {
37
+ exitFullScreen();
38
+ }
39
+ });
40
+
41
+ btn.addEventListener('click', () => {
42
+ if (!isMaximized) {
43
+ ElementUI.Message.info('全屏模式下部分弹窗可能无法正常显示。');
44
+
45
+ // 保存原始样式
46
+ originalStyles = {
47
+ position: el.style.position,
48
+ top: el.style.top,
49
+ left: el.style.left,
50
+ width: el.style.width,
51
+ height: el.style.height,
52
+ zIndex: el.style.zIndex
53
+ };
54
+
55
+ // 设置最大化样式
56
+ el.style.position = 'fixed';
57
+ el.style.top = '0';
58
+ el.style.left = '0';
59
+ el.style.width = '100%';
60
+ el.style.height = '100vh';
61
+ // 设置合适的z-index值,确保在el-dialog遮罩层(2000)之下
62
+ el.style.zIndex = '2000';
63
+ el.style.backgroundColor = originalBgColor;
64
+
65
+ btn.className = 'el-icon-close';
66
+ isMaximized = true;
67
+ } else {
68
+ exitFullScreen();
69
+ }
70
+ });
71
+ } else {
72
+ // 原生全屏模式
73
+ btn.className = 'el-icon-full-screen';
74
+ btn.addEventListener('click', () => {
75
+ if (!document.fullscreenElement) {
76
+ ElementUI.Message.info('全屏模式下部分弹窗可能无法正常显示。');
77
+
78
+ // 先设置页面全屏样式
79
+ el.style.position = 'fixed';
80
+ el.style.top = '0';
81
+ el.style.left = '0';
82
+ el.style.width = '100%';
83
+ el.style.height = '100vh';
84
+ el.style.zIndex = '2000';
85
+ el.style.backgroundColor = originalBgColor;
86
+
87
+ // 然后调用浏览器原生全屏
88
+ document.body.requestFullscreen();
89
+ btn.className = 'el-icon-close';
90
+ } else {
91
+ // 退出全屏时恢复样式
92
+ el.style.position = 'relative';
93
+ el.style.top = 'auto';
94
+ el.style.left = 'auto';
95
+ el.style.width = 'auto';
96
+ el.style.height = 'auto';
97
+ el.style.zIndex = 'auto';
98
+ document.exitFullscreen();
99
+ btn.className = 'el-icon-full-screen';
100
+ }
101
+ });
102
+
103
+ // 监听全屏变化
104
+ document.addEventListener('fullscreenchange', () => {
105
+ if (!document.fullscreenElement) {
106
+ btn.className = 'el-icon-full-screen';
107
+ el.style.backgroundColor = originalBgColor;
108
+ }
109
+ });
110
+ }
111
+
112
+ el.appendChild(btn);
113
+ }
114
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npmapps",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
Binary file