1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
data () {
return {
scrolled: false
}
},
ready () {
window.addEventListener('scroll', this.handleScroll);
},
methods:{
handleScroll () {
this.scrolled = window.scrollY;
console.log(this.scrolled)
},
},
destroyed () {
window.removeEventListener('scroll', this.handleScroll)
},
created: function () {
window.addEventListener('scroll', this.handleScroll)
}