Feature: Add on-no-more method to enable "end" display

This commit is contained in:
winkidney
2019-03-11 13:45:06 +08:00
committed by Isaac Bythewood
parent dfcd3f64d5
commit 78fa0c7e16
2 changed files with 15 additions and 3 deletions

View File

@@ -199,6 +199,9 @@ Vue.component('pin-container', {
this.$emit(
"loaded",
);
if (!hasNext) {
this.$emit("no-more-pins")
}
},
markAsLoading: function() {
this.status.loading = true;
@@ -294,6 +297,7 @@ var app = new Vue({
data() {
return {
loading: true,
noMore: false,
}
},
methods: {
@@ -303,5 +307,8 @@ var app = new Vue({
onLoading: function(){
this.loading = true;
},
onNoMore: function () {
this.noMore = true;
}
},
});

View File

@@ -1,7 +1,12 @@
{% extends "base.html" %}
{% block yield %}
<pin-container v-on:loaded="onLoaded()" v-on:loading="onLoading()">
</pin-container>
<div v-show="loading" class="spinner"></div>
<pin-container
v-on:loaded="onLoaded()"
v-on:loading="onLoading()"
v-on:no-more-pins="onNoMore()"
>
</pin-container>
<div v-show="loading" class="spinner"></div>
<div v-show="noMore">&mdash; End &mdash;</div>
{% endblock %}