调整缩放的问题

This commit is contained in:
2024-11-02 11:48:44 +08:00
parent 7aab2ccdf4
commit 39a8df2ea3
7 changed files with 20 additions and 7 deletions

View File

@@ -22,7 +22,8 @@ html, body, #app {
.pb-10 { .pb-10 {
padding-bottom: 10px; padding-bottom: 10px;
} }
.mb-10{
.mb-10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
@@ -43,7 +44,10 @@ export default {
const targetHeight = 1080; const targetHeight = 1080;
const ratio = targetWidth / targetHeight; const ratio = targetWidth / targetHeight;
const element = this.$el.querySelector('.components'); const element = this.$el.querySelector('.components');
const {width: originalWidth, height: originalHeight} = element.getBoundingClientRect(); if (!element) return
let {width: originalWidth, height: originalHeight} = this.$el.getBoundingClientRect();
originalWidth = originalWidth - 200
console.log("当前面板大小:", originalWidth, originalHeight)
const ratioHeight = originalWidth / ratio; const ratioHeight = originalWidth / ratio;
let scale let scale
if (ratioHeight < originalHeight) { if (ratioHeight < originalHeight) {
@@ -51,7 +55,6 @@ export default {
} else { } else {
scale = originalHeight / targetHeight; scale = originalHeight / targetHeight;
} }
element.style.transform = `scale(${scale})`; element.style.transform = `scale(${scale})`;
element.style.width = '1920px' element.style.width = '1920px'
element.style.height = '1080px' element.style.height = '1080px'
@@ -60,6 +63,10 @@ export default {
}, },
mounted() { mounted() {
this.scaleByAspect() this.scaleByAspect()
window.addEventListener('resize', this.scaleByAspect)
},
beforeDestroy() {
window.removeEventListener('resize', this.scaleByAspect)
} }
} }
</script> </script>

View File

@@ -2,7 +2,7 @@ import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
Vue.use(VueRouter) Vue.use(VueRouter)
const ctx = import.meta.glob('../views/App*.vue', {eager: true}) const ctx = import.meta.glob('../views/**/App*.vue', {eager: true})
const routes = [{path: '/', name: 'home'}] const routes = [{path: '/', name: 'home'}]
Object.values(ctx).map(file => { Object.values(ctx).map(file => {
if (file.default) { if (file.default) {

View File

@@ -65,6 +65,7 @@ window.evenRowBGC = (color = "#09265B") => `transparent;background-image: linear
Vue.prototype.$marketBoard = Vue.observable({ Vue.prototype.$marketBoard = Vue.observable({
screenId: '5b1849ac-4fc3-451a-844c-3362b47341ef', screenId: '5b1849ac-4fc3-451a-844c-3362b47341ef',
goodsCategoryId: "",
search: {"groupCodeList": [], "currentDate": "20240701", "compareDate": "20240630", "hourNum": "18"} search: {"groupCodeList": [], "currentDate": "20240701", "compareDate": "20240630", "hourNum": "18"}
}) })
Vue.prototype.$multipleStoreBoard = Vue.observable({ Vue.prototype.$multipleStoreBoard = Vue.observable({

View File

@@ -46,6 +46,9 @@ export default {
this.$nextTick(() => this.$storeBoard.dialog = true) this.$nextTick(() => this.$storeBoard.dialog = true)
} }
}) })
},
relevanceMapData(row){
console.log(arguments)
} }
} }
} }
@@ -54,7 +57,7 @@ export default {
<template> <template>
<section class="AppStoreKeyGoods"> <section class="AppStoreKeyGoods">
<div class="subTitle" v-text="'重点单品情况'"/> <div class="subTitle" v-text="'重点单品情况'"/>
<scroll-table :table-data="tableData" :columns="columns" @click="openNearbyStores" @click.native.stop/> <scroll-table :table-data="tableData" :columns="columns" @click="relevanceMapData" @click.native.stop/>
<!--<dv-scroll-board :config="tableConfig" @click="openNearbyStores" @click.native.stop/>--> <!--<dv-scroll-board :config="tableConfig" @click="openNearbyStores" @click.native.stop/>-->
</section> </section>
</template> </template>

View File

@@ -19,7 +19,6 @@ export default {
<template> <template>
<section class="AppMarketBoard"> <section class="AppMarketBoard">
<app-navbar class="mb-10"/> <app-navbar class="mb-10"/>
<app-market-board-filter/>
<div class="flex" style="gap:20px"> <div class="flex" style="gap:20px">
<div class="fill"> <div class="fill">
<div class="flex gap"> <div class="flex gap">
@@ -28,7 +27,10 @@ export default {
<app-sales-performance style="margin-bottom: 10px"/> <app-sales-performance style="margin-bottom: 10px"/>
<app-key-goods style="height: 208px"/> <app-key-goods style="height: 208px"/>
</div> </div>
<app-map class="fill"/> <div class="fill">
<app-market-board-filter/>
<app-map style="height: calc(100% - 50px)"/>
</div>
</div> </div>
<div class="flex gap" style="height: 394px"> <div class="flex gap" style="height: 394px">
<app-group-monitor-table class="fill"/> <app-group-monitor-table class="fill"/>