1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > html高度自适应vue vue页面div高度自适应

html高度自适应vue vue页面div高度自适应

时间:2024-02-27 11:57:06

相关推荐

html高度自适应vue vue页面div高度自适应

第一种方式:

export default{

data(){

conheight:{

height:''

}

},

methods:{

getHeight(){

this.conheight.height=window.innerHeight-170+'px';

},

created(){

window.addEventListener('resize', this.getHeight);

this.getHeight()

}

}

第二种方式:

评测管理员

登录

注册

export default{

name:"Login",

data () {

return {

fullHeight: document.documentElement.clientHeight

}

},

watch: {

fullHeight (val) {//监控浏览器高度变化

if(!this.timer) {

this.fullHeight = val

this.timer = true

let that = this

setTimeout(function (){

that.timer = false

},400)

}

}

},

mounted () {

this.get_bodyHeight()

},

methods :{

get_bodyHeight () {//动态获取浏览器高度

const that = this

window.onresize = () => {

return (() => {

window.fullHeight = document.documentElement.clientHeight

that.fullHeight = window.fullHeight

})()

}

}

}

}

@import '../../assets/style/auth/loginOrReg.css';

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。