From 3bb73cd75707f313b5d58753c3d88783f7b117cd Mon Sep 17 00:00:00 2001 From: les Date: Wed, 14 Apr 2021 01:35:18 +0200 Subject: [PATCH] loading on filters update --- pages/index.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 0b12fae6..70c9f7e9 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -71,6 +71,13 @@ export default { } }, computed: mapState(['settings', 'announcements', 'filters']), + mounted () { + const tags = document.location.hash.split('#').map(tag => decodeURIComponent(tag)) + if (tags) { + this.setFilters({ ...this.filters, tags }) + this.updateEvents() + } + }, methods: { // onIntersect (isIntersecting, eventId) { // this.intersecting[eventId] = isIntersecting @@ -95,8 +102,9 @@ export default { this.updateEvents() }, tagClick (tag) { + this.$nuxt.$loading.start() + this.$router.push(`#${tag}`) if (this.filters.tags.includes(tag)) { - this.filters.tags = this.filters.tags.filter(t => t !== tag) this.setFilters({ ...this.filters, tags: this.filters.tags.filter(t => t !== tag) }) } else { this.setFilters({ ...this.filters, tags: [].concat(this.filters.tags, tag) }) @@ -124,15 +132,17 @@ export default { this.updateEvents() }, updateFilters (filters) { + this.$nuxt.$loading.start() this.setFilters(filters) this.updateEvents() }, dayChange (day) { + this.$nuxt.$loading.start() const date = dayjs(day.date).format('YYYY-MM-DD') if (this.selectedDay === date) { this.selectedDay = null - this.start = dayjs().unix() // .startOf('week').unix() - this.end = null + this.start = dayjs(day.date).startOf('month').unix() // .startOf('week').unix() + this.end = dayjs(day.date).endOf('month').unix() this.updateEvents() return }