some modify

This commit is contained in:
jiaming 2018-12-26 15:01:57 +08:00
parent 081cf3a3ca
commit c517b719c9
2 changed files with 33 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="demo">
<div class="demo" ref="demo">
<div class="menu-bar">
<div :class="`menu-item ${activeIndex === index && 'active'}`"
v-for="(item, index) in menuData"
@ -51,6 +51,28 @@ export default {
}
},
methods: {
scaleScreen () {
const { $refs } = this
const demoDom = $refs['demo']
const { height } = screen
const bdWidth = document.body.clientWidth
const bdHeight = document.body.clientHeight
if (bdWidth < 1500) {
const scale = bdWidth / 1500
demoDom.style.transform = `scale(${scale})`
demoDom.style.height = bdHeight * (height / bdHeight) * (1 / scale) + 'px'
}
},
bindReSizeEventHandler () {
const { debounce, scaleScreen } = this
if (!debounce) return
window.addEventListener('resize', debounce(100, scaleScreen))
},
initActiveIndex () {
const { $route: { name }, menuData } = this
@ -61,6 +83,13 @@ export default {
const { initActiveIndex } = this
initActiveIndex()
},
mounted () {
const { scaleScreen, bindReSizeEventHandler } = this
scaleScreen()
bindReSizeEventHandler()
}
}
</script>
@ -72,7 +101,8 @@ export default {
background-image: url('../../assets/img/bg.png');
background-size: 100%;
color: #fff;
min-width: 1400px;
min-width: 1500px;
transform-origin: left top;
.menu-bar {
position: absolute;

View File

@ -33,7 +33,7 @@ textAlign: ['center', 'center']
// rowNum
// oddBG
// evenBG
// titBG
// titleBG
// carousel page
</highlight-code>
</div>