2025-07-17 10:28:56 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="app-container">
|
2025-08-12 11:50:27 +08:00
|
|
|
|
<router-view />
|
2025-07-17 10:28:56 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-08-12 11:50:27 +08:00
|
|
|
|
import { onMounted, onUnmounted } from "vue"
|
2025-08-08 17:51:36 +08:00
|
|
|
|
const disableZoom = () => {
|
2025-08-11 17:05:47 +08:00
|
|
|
|
// 强制重置浏览器缩放为 100%
|
|
|
|
|
|
const resetZoom = () => {
|
|
|
|
|
|
document.body.style.zoom = "100%"
|
|
|
|
|
|
if (window.devicePixelRatio !== 1) {
|
|
|
|
|
|
const viewportMeta = document.querySelector('meta[name="viewport"]')
|
|
|
|
|
|
if (viewportMeta) {
|
|
|
|
|
|
viewportMeta.content =
|
|
|
|
|
|
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 禁用快捷键(Ctrl/Cmd + +/-/0 和 滚轮)
|
2025-08-08 17:51:36 +08:00
|
|
|
|
const keysToBlock = new Set(["+", "-", "=", "0"])
|
|
|
|
|
|
const codesToBlock = new Set(["Equal", "Minus", "NumpadAdd", "NumpadSubtract", "Digit0"])
|
2025-08-11 17:05:47 +08:00
|
|
|
|
const handleKeyDown = (e) => {
|
|
|
|
|
|
if ((e.ctrlKey || e.metaKey) && (keysToBlock.has(e.key) || codesToBlock.has(e.code))) {
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
const handleWheel = (e) => {
|
|
|
|
|
|
if (e.ctrlKey) {
|
2025-08-08 17:51:36 +08:00
|
|
|
|
e.preventDefault()
|
2025-08-11 17:05:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化
|
|
|
|
|
|
resetZoom()
|
|
|
|
|
|
document.addEventListener("keydown", handleKeyDown)
|
|
|
|
|
|
document.addEventListener("wheel", handleWheel, { passive: false })
|
|
|
|
|
|
|
|
|
|
|
|
// 可选,用于组件卸载时移除监听
|
|
|
|
|
|
return () => {
|
|
|
|
|
|
document.removeEventListener("keydown", handleKeyDown)
|
|
|
|
|
|
document.removeEventListener("wheel", handleWheel)
|
|
|
|
|
|
}
|
2025-08-08 17:51:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
2025-08-13 10:41:33 +08:00
|
|
|
|
// const cleanup = disableZoom()
|
|
|
|
|
|
// onUnmounted(() => cleanup())
|
2025-08-08 17:51:36 +08:00
|
|
|
|
})
|
2025-07-17 10:28:56 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-08-19 11:23:46 +08:00
|
|
|
|
<style scoped lang="scss">
|
2025-07-17 10:28:56 +08:00
|
|
|
|
.app-container {
|
2025-08-19 11:23:46 +08:00
|
|
|
|
max-width: vw(1920);
|
|
|
|
|
|
min-height: vh(1080);
|
2025-08-12 12:16:47 +08:00
|
|
|
|
background: url("@/assets/images/bci.png");
|
|
|
|
|
|
background-size: cover;
|
2025-07-17 10:28:56 +08:00
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
|
background-position: center;
|
|
|
|
|
|
background-color: #02131f;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|