利用组件的路由实现:
具体如下:
```
beforeRouteEnter (to, from, next) {
// ...
window.document.body.style.backgroundColor = '#EBEBEB';
next();
},
beforeRouteLeave (to, from, next) {
// ...
window.document.body.style.backgroundColor = '';
next();
},
```
网友评论