[TOC]
## 1.设置滚动
```
mounted() {
window.addEventListener("scroll", this.handleScroll);
});
```
## 2. 清除滚动
```
destroyed() {
window.removeEventListener("scroll", this.handleScroll);
},
```
## 3.设置滚动具体效果
> isNav 是设置的滚动触发的效果
```
handleScroll() {
var top = document.documentElement.scrollTop || document.body.scrollTop;
if (top > 0) {
this.isNav = true;
var opacity = top / 200;
if (opacity > 1) {
opacity = 1;
}
this.opacitys.opacity = opacity;
} else {
this.isNav = false;
}
},
```