【发布时间】:2018-04-29 20:11:55
【问题描述】:
我正在寻找解决方案并想出了这段代码
methods: {
handleScroll () {
console.log(window.scrollY)
}
},
created () {
window.addEventListener('scroll', this.handleScroll);
},
destroyed () {
window.removeEventListener('scroll', this.handleScroll);
}
不幸的是,这对我不起作用。我还尝试将窗口更改为 document.body。
错误信息是Window is not defined
【问题讨论】: