vue.js实现滚动监听(scroll)

vue.js实现滚动监听(scroll)
简简单单,直接上代码: data () { return { scrolled: false }; }, methods: { handleScroll () { this.scrolled = window.scrollY > 0; } }, created () { window.addEventListener('scroll', this.handleScroll); }, destroyed () { window.removeEventListener('scroll', this.handleScroll); } 12345678910111213141516 data () {r...
Copyright © 前端面试题 保留所有权利.   Theme  Ality 桂ICP备17012235号-1

用户登录