Vue给单独页面添加背景色

来源:互联网 发布:小米网络劫持怎么解决 编辑:程序博客网 时间:2024/05/15 23:47

由于外层还有一个div,所以设置背景色100%的时候不能全部都被背景色覆盖。
如果给HTML设置背景色还会影响到其他页面的背景色。
解决办法:
给style添加一个scoped表示当前样式只给当前页面设置。
单独设置背景的方法是在单独页面外层添加一个div,将这个div属性设为:fixed,例如:

<style scoped>    .homeBox {        position: fixed;        width: 100%;        height: 100%;        top: 0px;        background-color: #ffffff;    }</style>

内部样式会跟随上移,添加一个margin-top即可。