data() {//Storing data}]."/> data() {//Storing data}].">
Home > Article > Web Front-end > How to dynamically set element height in vue.js
vue.js method to dynamically set element height: [d04fcf98c7c315a5d55dc020e0d4da5f16b28748ea4df4d9c2150843fecfba68data() {//Storing data} 】.
The operating environment of this article: windows10 system, vue.js 2.9, thinkpad t480 computer.
Without further ado, let’s go directly to the code:
vue code:
<div :style="{width: divWidth, height: divHeight}"></div>
data data:
data() { //这里存放数据 return { divHeight:0, divWidth:0 } },
created method assignment
created(){ let divWidth = document.body.clientWidth+"px"; let divHeight = document.body.clientHeight-130+"px"; this.divWidth = divWidth this.divHeight = divHeight },
Recommended learning: php training
The above is the detailed content of How to dynamically set element height in vue.js. For more information, please follow other related articles on the PHP Chinese website!