created () {
    this.listenerFunction();
},
beforeDestroy () {
    document.removeEventListener("scroll", this.listenerFunction);
},
method () {
    listenerFunction(e) {
        document.addEventListener('scroll', this.handleScroll, true);
    },
    handleScroll () {
        console.log(window.pageYOffset)
    }
}
Logo

前往低代码交流专区

更多推荐