【css/vue】Vue组件中对body操作样式的一种解决方案

由于vue组件中四周总会出现白空隙,而在vue中又没有像html中对body样式的修改,因此,需要通过一个最外的div来解决。

<template>


    <div class="bg">
    </div>
</template>


<style>
.bg{
     position: absolute;
     top: 0;
     left: 0;
     width: 100%; 
     height: 100%;
     overflow-y: auto;
     background-color: red;
}
</style>

猜你喜欢

转载自blog.csdn.net/dxnn520/article/details/128514029