Files
kengee-data-screen/src/App.vue

66 lines
1.3 KiB
Vue
Raw Normal View History

2024-05-22 17:03:33 +08:00
<template>
<div id="app">
2024-06-17 18:20:13 +08:00
<div class="flex">
2024-06-17 21:16:49 +08:00
<apps-nav/>
2024-08-23 17:05:29 +08:00
<router-view class="components fill"/>
2024-06-17 18:20:13 +08:00
</div>
2024-05-22 17:03:33 +08:00
</div>
</template>
2024-06-17 18:20:13 +08:00
<style>
html, body, #app {
width: 100vw;
height: 100vh;
margin: 0;
2024-06-17 21:16:49 +08:00
overflow: hidden;
2024-05-22 17:03:33 +08:00
}
2024-06-17 23:18:11 +08:00
2024-07-05 17:36:16 +08:00
#app > .flex {
height: 100%;
}
2024-10-22 10:08:51 +08:00
.pb-10 {
padding-bottom: 10px;
}
.mb-10{
margin-bottom: 10px;
}
2024-06-17 23:18:11 +08:00
.components {
background: #07193D;
2024-08-23 17:05:29 +08:00
2024-06-17 23:18:11 +08:00
}
2024-05-22 17:03:33 +08:00
</style>
2024-06-17 21:16:49 +08:00
<script>
import AppsNav from "@/components/appsNav.vue";
export default {
name: "App",
components: {AppsNav},
2024-08-23 17:05:29 +08:00
methods: {
scaleByAspect() {
const targetWidth = 1920;
const targetHeight = 1080;
const ratio = targetWidth / targetHeight;
const element = this.$el.querySelector('.components');
const {width: originalWidth, height: originalHeight} = element.getBoundingClientRect();
const ratioHeight = originalWidth / ratio;
let scale
if (ratioHeight < originalHeight) {
scale = originalWidth / targetWidth;
} else {
scale = originalHeight / targetHeight;
}
element.style.transform = `scale(${scale})`;
element.style.width = '1920px'
element.style.height = '1080px'
element.style.transformOrigin = 'top center';
}
},
mounted() {
this.scaleByAspect()
}
2024-06-17 21:16:49 +08:00
}
2024-06-17 18:20:13 +08:00
</script>