动态修改尺寸
This commit is contained in:
parent
ac50cfb0a1
commit
b39cbf142c
|
|
@ -14,4 +14,5 @@
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- built files will be auto injected -->
|
<!-- built files will be auto injected -->
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="data-view">
|
<div id="data-view">
|
||||||
<dv-full-screen-container>
|
<!-- <dv-full-screen-container> -->
|
||||||
|
<div id="dv-full-screen-container" style="width: 100%;height: 100%;position: fixed;overflow: hidden;">
|
||||||
|
|
||||||
|
|
||||||
<top-header :Name = "showData.name" :Times = "showData.times"/>
|
<top-header :Name = "showData.name" :Times = "showData.times"/>
|
||||||
|
|
||||||
<div class="main-content" v-if="loadingDone">
|
<div class="main-content" v-if="loadingDone">
|
||||||
|
|
@ -25,7 +27,8 @@
|
||||||
<dv-loading v-else>Loading...</dv-loading>
|
<dv-loading v-else>Loading...</dv-loading>
|
||||||
<div style="height: 5%;width: 100%;"></div>
|
<div style="height: 5%;width: 100%;"></div>
|
||||||
|
|
||||||
</dv-full-screen-container>
|
<!-- </dv-full-screen-container> -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
this.config.headerHeight = this.$fontSize(0.50);
|
||||||
|
this.config.columnWidth = [this.$fontSize(1),this.$fontSize(1.5),this.$fontSize(1)];
|
||||||
this.config.data = JSON.parse(JSON.stringify(this.ScrollList))
|
this.config.data = JSON.parse(JSON.stringify(this.ScrollList))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -35,7 +37,7 @@ export default {
|
||||||
#scroll-board {
|
#scroll-board {
|
||||||
width:25%;
|
width:25%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin-left: 20px;
|
margin-left: 0.2rem;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
@ -43,10 +45,10 @@ export default {
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
.dv-scroll-board .header{
|
.dv-scroll-board .header{
|
||||||
font-size: 20px !important;
|
font-size: 0.2rem !important;
|
||||||
font-weight: bold !important;
|
font-weight: bold !important;
|
||||||
}
|
}
|
||||||
.dv-scroll-board .rows .row-item{
|
.dv-scroll-board .rows .row-item{
|
||||||
font-size: 20px !important;
|
font-size: 0.2rem !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
12
src/main.js
12
src/main.js
|
|
@ -8,7 +8,17 @@ import api from './api'
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.prototype.$api = api
|
Vue.prototype.$api = api
|
||||||
|
function resizeFont() {
|
||||||
|
const designWidth = 1920; // 设计稿宽度,例如iPhone 6的宽度
|
||||||
|
const maxWidth = 1920; // 最大支持宽度
|
||||||
|
const screenWidth = Math.min(window.innerWidth, maxWidth);
|
||||||
|
const scale = screenWidth / designWidth;
|
||||||
|
document.documentElement.style.fontSize = `${100 * scale}px`;
|
||||||
|
}
|
||||||
|
// 初始调用
|
||||||
|
resizeFont();
|
||||||
|
// 监听窗口大小变化
|
||||||
|
window.addEventListener('resize', resizeFont);
|
||||||
let fontSize = function(res) {
|
let fontSize = function(res) {
|
||||||
let clientWidth =
|
let clientWidth =
|
||||||
window.innerWidth ||
|
window.innerWidth ||
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue