vue_zhongyou 1.0.18 → 1.0.20
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/package.json +1 -1
- package//345/212/237/350/203/275/344/273/243/347/240/201//351/241/265/351/235/242/345/223/215/345/272/224/345/274/217/351/200/202/351/205/215/main.js +14 -0
- package//345/212/237/350/203/275/344/273/243/347/240/201//351/241/265/351/235/242/345/223/215/345/272/224/345/274/217/351/200/202/351/205/215/vite.config.js +0 -0
- package//345/212/237/350/203/275/344/273/243/347/240/201//351/241/265/351/235/242/345/223/215/345/272/224/345/274/217/351/200/202/351/205/215/zoom.js +28 -0
- package//346/217/222/344/273/266/BCompare-zh-5.0.1.29877.exe +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/main.js
|
|
2
|
+
import { createApp } from 'vue'
|
|
3
|
+
import App from './App.vue'
|
|
4
|
+
import './assets/main.css'
|
|
5
|
+
|
|
6
|
+
// 引入系统缩放感知
|
|
7
|
+
import { initSystemZoom } from './utils/zoom'
|
|
8
|
+
|
|
9
|
+
// 初始化系统缩放
|
|
10
|
+
initSystemZoom()
|
|
11
|
+
|
|
12
|
+
// 创建应用
|
|
13
|
+
const app = createApp(App)
|
|
14
|
+
app.mount('#app')
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/utils/zoom.js
|
|
2
|
+
export function initSystemZoom() {
|
|
3
|
+
// 创建测试元素,测量系统缩放比例
|
|
4
|
+
const testDiv = document.createElement('div')
|
|
5
|
+
testDiv.style.width = '100px'
|
|
6
|
+
testDiv.style.height = '100px'
|
|
7
|
+
testDiv.style.position = 'absolute'
|
|
8
|
+
testDiv.style.top = '-9999px'
|
|
9
|
+
document.body.appendChild(testDiv)
|
|
10
|
+
|
|
11
|
+
// 获取测试元素的实际宽度
|
|
12
|
+
const actualWidth = testDiv.offsetWidth
|
|
13
|
+
document.body.removeChild(testDiv)
|
|
14
|
+
|
|
15
|
+
// 计算系统缩放比例
|
|
16
|
+
const zoomRatio = 100 / actualWidth
|
|
17
|
+
|
|
18
|
+
// 设置rem基准值(16px * 缩放比例)
|
|
19
|
+
const remBase = 16 * zoomRatio
|
|
20
|
+
document.documentElement.style.fontSize = `${remBase}px`
|
|
21
|
+
|
|
22
|
+
console.log(`系统缩放比例: ${zoomRatio.toFixed(2)}, rem基准: ${remBase}px`)
|
|
23
|
+
|
|
24
|
+
// 监听resize事件,处理缩放变化
|
|
25
|
+
window.addEventListener('resize', initSystemZoom)
|
|
26
|
+
|
|
27
|
+
return zoomRatio
|
|
28
|
+
}
|
|
Binary file
|