add lib folder
This commit is contained in:
6
lib/components/fullScreenContainer/index.js
Normal file
6
lib/components/fullScreenContainer/index.js
Normal file
@ -0,0 +1,6 @@
|
||||
import './src/main.css'
|
||||
import FullScreenContainer from './src/main.vue'
|
||||
|
||||
export default function (Vue) {
|
||||
Vue.component(FullScreenContainer.name, FullScreenContainer)
|
||||
}
|
8
lib/components/fullScreenContainer/src/main.css
Normal file
8
lib/components/fullScreenContainer/src/main.css
Normal file
@ -0,0 +1,8 @@
|
||||
#dv-full-screen-container {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
overflow: hidden;
|
||||
transform-origin: left top;
|
||||
z-index: 999;
|
||||
}
|
57
lib/components/fullScreenContainer/src/main.vue
Normal file
57
lib/components/fullScreenContainer/src/main.vue
Normal file
@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div id="dv-full-screen-container" :ref="ref">
|
||||
<template v-if="ready">
|
||||
<slot></slot>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import autoResize from '../../../mixin/autoResize.js'
|
||||
|
||||
export default {
|
||||
name: 'DvFullScreenContainer',
|
||||
mixins: [autoResize],
|
||||
data () {
|
||||
return {
|
||||
ref: 'full-screen-container',
|
||||
allWidth: 0,
|
||||
scale: 0,
|
||||
datavRoot: '',
|
||||
ready: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
afterAutoResizeMixinInit () {
|
||||
const { initConfig, setAppScale } = this
|
||||
|
||||
initConfig()
|
||||
|
||||
setAppScale()
|
||||
|
||||
this.ready = true
|
||||
},
|
||||
initConfig () {
|
||||
const { dom } = this
|
||||
const { width, height } = screen
|
||||
|
||||
this.allWidth = width
|
||||
|
||||
dom.style.width = `${width}px`
|
||||
dom.style.height = `${height}px`
|
||||
},
|
||||
setAppScale () {
|
||||
const { allWidth, dom } = this
|
||||
|
||||
const currentWidth = document.body.clientWidth
|
||||
|
||||
dom.style.transform = `scale(${currentWidth / allWidth})`
|
||||
},
|
||||
onResize () {
|
||||
const { setAppScale } = this
|
||||
|
||||
setAppScale()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user