vue高度自适应与背景颜色+组件


import myhea from '@/components/hea.vue'
export default {
name: 'App',
props: ["titlevlu", "lefttext"],
components: {
myhea
},
data() {
return {
myactive: 0,
conheight: {
height: ''
}
};
},
mounted() {
document.querySelector('body').setAttribute('style', 'background-color:#F4F5F7')
},
beforeDestroy() {
document.querySelector('body').removeAttribute('style')
},
methods: {
getHeight() {
this.conheight.height = window.innerHeight - 170 + 'px';
},
created() {
window.addEventListener('resize', this.getHeight);
this.getHeight()
}
},
}

  

<div :style="conheight">

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM