(this.comments = data));
},
+ handleScroll() {
+ if (this.loading || !this.comments || !this.comments.nextpage) return;
+ if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
+ this.loading = true;
+ this.fetchJson(
+ Constants.BASE_URL +
+ "/nextpage/comments/" +
+ this.$route.query.v +
+ "?url=" +
+ encodeURIComponent(this.comments.nextpage),
+ ).then(json => {
+ this.comments.nextpage = json.nextpage;
+ this.loading = false;
+ json.comments.map(comment => this.comments.comments.push(comment));
+ });
+ }
+ },
},
components: {
Player,