利用组件的路由实现:
具体如下:
```
beforeRouteEnter (to, from, next) {
// ...
window.document.body.style.backgroundColor = '#EBEBEB';
next();
},
beforeRouteLeave (to, from, next) {
// ...
window.document.body.style.backgroundColor = '';
next();
},
```
利用组件的路由实现:
具体如下:
```
beforeRouteEnter (to, from, next) {
// ...
window.document.body.style.backgroundColor = '#EBEBEB';
next();
},
beforeRouteLeave (to, from, next) {
// ...
window.document.body.style.backgroundColor = '';
next();
},
```
本文标题:vue 为不同页面的body设置不同背景色
本文链接:https://www.haomeiwen.com/subject/zrlnectx.html
网友评论