Improve scroll performance
This commit is contained in:
parent
8678e30cc8
commit
999ce8e366
|
@ -74,7 +74,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
|
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
|
||||||
window.addEventListener('scroll', this.onScroll);
|
window.addEventListener('scroll', this.onScroll, { passive: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$refs.body.addEventListener('scroll', this.onScroll);
|
this.$refs.body.addEventListener('scroll', this.onScroll, { passive: true });
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.$refs.body.removeEventListener('scroll', this.onScroll);
|
this.$refs.body.removeEventListener('scroll', this.onScroll);
|
||||||
|
|
|
@ -46,7 +46,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.addEventListener('keydown', this.onDocumentKeydown);
|
document.addEventListener('keydown', this.onDocumentKeydown);
|
||||||
window.addEventListener('scroll', this.onScroll);
|
window.addEventListener('scroll', this.onScroll, { passive: true });
|
||||||
|
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
|
|
|
@ -37,7 +37,7 @@ export default Vue.extend({
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.user.bannerUrl) {
|
if (this.user.bannerUrl) {
|
||||||
window.addEventListener('load', this.onScroll);
|
window.addEventListener('load', this.onScroll);
|
||||||
window.addEventListener('scroll', this.onScroll);
|
window.addEventListener('scroll', this.onScroll, { passive: true });
|
||||||
window.addEventListener('resize', this.onScroll);
|
window.addEventListener('resize', this.onScroll);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -81,7 +81,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
|
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
|
||||||
window.addEventListener('scroll', this.onScroll);
|
window.addEventListener('scroll', this.onScroll, { passive: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|
Loading…
Reference in New Issue