DemuMesDataV/src/App.vue

73 lines
1.3 KiB
Vue
Raw Normal View History

2018-12-04 11:43:18 +08:00
<template>
2018-12-11 14:52:12 +08:00
<div id="app" ref="data-root">
<current-data-v />
2018-12-04 11:43:18 +08:00
</div>
</template>
<script>
2018-12-11 14:52:12 +08:00
import currentDataV from './views/electronicFile/index'
// import currentDataV from './views/manageDesk/index'
2018-12-04 11:43:18 +08:00
export default {
name: 'app',
components: {
currentDataV
},
data () {
return {
scale: 0,
app: ''
}
},
methods: {
init () {
const { initConfig, setAppScale, bindReSizeEventHandler } = this
initConfig()
setAppScale()
bindReSizeEventHandler()
},
initConfig () {
const { width, height } = screen
this.allWidth = width
2018-12-11 14:52:12 +08:00
const app = this.app = this.$refs['data-root']
app.style.width = `${width}px`
app.style.height = `${height}px`
},
setAppScale () {
const { allWidth, app } = this
const currentWidth = document.body.clientWidth
app.style.transform = `scale(${currentWidth / allWidth})`
},
bindReSizeEventHandler () {
const { debounce, setAppScale } = this
if (!debounce) return
window.addEventListener('resize', debounce(100, setAppScale))
}
},
mounted () {
const { init } = this
init()
2018-12-04 11:43:18 +08:00
}
}
</script>
<style lang="less">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
transform-origin: left top;
overflow: hidden;
2018-12-10 18:22:06 +08:00
user-select: none;
2018-12-04 11:43:18 +08:00
}
</style>