-
曲线救国写法
<template> <div class="body-bg"></div>//代替body </template> <style scoped lang="scss"> .body-bg { position: absolute; width: 100%; height: 100%; top: 0; left: 0; overflow-y: auto; background-color: #fff; } </style>
-
生命周期添加
beforeCreate() { document.querySelector('body').setAttribute('style', 'background:#eee') }, beforeDestroy() { document.querySelector('body').removeAttribute('style') }, //同时在再style标签上加scoped即可;
网友评论