Feature: Initial commit for waterfall component by vue

This commit is contained in:
winkidney
2019-02-25 18:12:04 +08:00
committed by Isaac Bythewood
parent c2515542da
commit 6318500594
4 changed files with 67 additions and 11 deletions

View File

@@ -0,0 +1,36 @@
function fetchPins(offset) {
var apiUrl = API_BASE + 'pins/?format=json&ordering=-id&limit=50&offset='+String(offset);
if (tagFilter) apiUrl = apiUrl + '&tags__name=' + tagFilter;
if (userFilter) apiUrl = apiUrl + '&submitter__username=' + userFilter;
return axios.get(apiUrl)
}
var app = new Vue({
el: '#app',
components: {
'waterfall': Waterfall.waterfall,
'waterfall-slot': Waterfall.waterfallSlot,
},
data() {
return {
pins: [],
loading: true,
}
},
methods: {
getInitialPins: function () {
var self = this;
var offset = 0;
fetchPins(offset).then(
function (res) {
self.pins = res.data.results;
self.loading = false;
}
);
},
},
created: function () {
this.getInitialPins();
},
});