Elements can be styled through style.
It should be noted that: style is an object, which can only get inline styles (written in tags) , not inline styles and external chain styles.
<div style="height:100px;width:100px; background-color:pink;" class="box">style</div>
.box{
color: orange;
}
mounted(){
let ele = document.querySelector('.box');
console.log(ele.style.height);// 内联样式,打印为100px
console.log(ele.style.height);// 内联样式,打印为100px
console.log(ele.style.color);// 通过clssName设置,非内联样式,获取不到,是空值
console.log(ele.style.backgroundColor);// 内联样式,打印为pink。
The result is as follows: