data(){
return{
clientHeight:'',
}
}
mouted(){
this.clientHeight = `${document.documentElement.clientHeight}`;//獲取瀏覽器可視區域高度
let that = this;
window.onresize = function(){
this.clientHeight = `${document.documentElement.clientHeight}`;
if(that.$refs.page){
that.$refs.page.style.minHeight = clientHeight - 100 + 'px';
}
}
}
watch:{
clientHeight(){ //如果clientHeight 發生改變,這個函數就會運行
this.changeFixed(this.clientHeight)
}
}
methods:{
changeFixed(clientHeight){
if(this.$refs.page){
this.$refs.page.style.minHeight = clientHeight -100 + 'px';
}
}
}