This commit is contained in:
汪汇 2024-07-24 15:24:29 +08:00
parent e6e2092913
commit 915a79c8a7
1 changed files with 21 additions and 10 deletions

View File

@ -13,8 +13,19 @@
<script setup> <script setup>
import Header from "../components/header.vue"; import Header from "../components/header.vue";
import { ref, onMounted, onBeforeMount } from "vue"; import { ref, onMounted, onBeforeMount ,watch} from "vue";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const routers = useRoute();
console.log(routers.path);
watch(
() => routers.path,
(newVal, oldVal) => {
if (routers.path == '/home/index/map') {
reset_font()
}
}
);
const reset_font = () => { const reset_font = () => {
let width = document.documentElement.clientWidth || document.body.clientWidth; let width = document.documentElement.clientWidth || document.body.clientWidth;
let height = let height =
@ -29,14 +40,14 @@ const reset_font = () => {
document.querySelector(".header_content").style.transformOrigin = "top left"; document.querySelector(".header_content").style.transformOrigin = "top left";
document.querySelector(".header_content").style.transform = document.querySelector(".header_content").style.transform =
"scale(" + width / 1920 + "," + height / 1080 + ")"; "scale(" + width / 1920 + "," + height / 1080 + ")";
if( if (
document.querySelector(".left").style){ document.querySelector(".left")) {
document.querySelector(".left").style.transformOrigin = "bottom left"; document.querySelector(".left").style.transformOrigin = "bottom left";
document.querySelector(".left").style.transform = document.querySelector(".left").style.transform =
"scale(" + width / 1920 + "," + height / 1080 + ")"; "scale(" + width / 1920 + "," + height / 1080 + ")";
document.querySelector(".right").style.transformOrigin = "bottom right"; document.querySelector(".right").style.transformOrigin = "bottom right";
document.querySelector(".right").style.transform = document.querySelector(".right").style.transform =
"scale(" + width / 1920 + "," + height / 1080 + ")"; "scale(" + width / 1920 + "," + height / 1080 + ")";
} }