1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-01 15:45:58 +09:00

Improve scroll performance

This commit is contained in:
syuilo 2018-06-07 01:52:03 +09:00
parent 8678e30cc8
commit 999ce8e366
5 changed files with 5 additions and 5 deletions

View File

@ -74,7 +74,7 @@ export default Vue.extend({
mounted() {
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
window.addEventListener('scroll', this.onScroll);
window.addEventListener('scroll', this.onScroll, { passive: true });
},
beforeDestroy() {

View File

@ -51,7 +51,7 @@ export default Vue.extend({
},
mounted() {
this.$refs.body.addEventListener('scroll', this.onScroll);
this.$refs.body.addEventListener('scroll', this.onScroll, { passive: true });
},
beforeDestroy() {
this.$refs.body.removeEventListener('scroll', this.onScroll);

View File

@ -46,7 +46,7 @@ export default Vue.extend({
},
mounted() {
document.addEventListener('keydown', this.onDocumentKeydown);
window.addEventListener('scroll', this.onScroll);
window.addEventListener('scroll', this.onScroll, { passive: true });
this.fetch();
},

View File

@ -37,7 +37,7 @@ export default Vue.extend({
mounted() {
if (this.user.bannerUrl) {
window.addEventListener('load', this.onScroll);
window.addEventListener('scroll', this.onScroll);
window.addEventListener('scroll', this.onScroll, { passive: true });
window.addEventListener('resize', this.onScroll);
}
},

View File

@ -81,7 +81,7 @@ export default Vue.extend({
mounted() {
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
window.addEventListener('scroll', this.onScroll);
window.addEventListener('scroll', this.onScroll, { passive: true });
},
beforeDestroy() {