在 data 中定义 height 初始值
data () {
return {
height : 200,
}
},
在mounted中,onresize事件会在页面大小被调整时触发
mounted () {
this.height = document.body.clientHeight - 195;
// 窗口重置时候,重新获取高度
window.onresize = () => {
return (() => {
this.height = document.body.clientHeight - 195;
})();
};
},
height的值为:Number(如:200),无px等单位。