Skip to content
This repository was archived by the owner on Jun 22, 2020. It is now read-only.

Commit 3953e53

Browse files
committed
feature: complete infinite scroll
1 parent ccd22ad commit 3953e53

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/pages/index.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ export default {
159159
await axios.post(url, body)
160160
},
161161
async moreComments(){
162-
console.log('more')
163162
this.busy = true
164163
const url = `${this.baseURL['db']}/comment/more`
165164
const body = {
@@ -171,9 +170,16 @@ export default {
171170
this.loading = true
172171
const result = await axios.get(url, body)
173172
this.loading = false
174-
this.comments = this.comments.concat(result.data)
175-
this.numOfComments += 20
176-
this.busy = false
173+
if(result.data.length != 0){
174+
this.comments = this.comments.concat(result.data)
175+
this.numOfComments += 20
176+
this.busy = false
177+
}
178+
else{
179+
setTimeout(()=>{
180+
this.busy = false
181+
},10000)
182+
}
177183
},
178184
async postAnswer(){
179185
const url = `${this.baseURL['db']}/quiz/${this.quiz.quizID}/${this.answerTextarea}`

0 commit comments

Comments
 (0)