From 67eb49f6fc8caa7b771503182aa0f9586c88a91a Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Wed, 8 Feb 2017 23:00:56 +0100 Subject: [PATCH] fixes #26: update information when the month is changed --- package.json | 2 +- src/App.vue | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 926029b..3fbaa0b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "vue-material": "^0.6.3", "vue-resource": "^1.0.3", "vue-router": "^2.1.1", - "vuejs-datepicker": "^0.4.27", + "vuejs-datepicker": "^0.5.5", "vuex": "^2.1.1" }, "devDependencies": { diff --git a/src/App.vue b/src/App.vue index f4239d8..c744079 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,7 +2,7 @@
- + @@ -99,6 +99,9 @@ export default { if (!(this.date && !isNaN(this.date.getTime()))) { this.date = new Date(); } + $('div.calendar span.prev').on('click', this.changeMonth); + $('div.calendar span.next').on('click', this.changeMonth); + $('div.calendar span.month').on('click', this.changeMonth); this.reload(); }, @@ -109,6 +112,14 @@ export default { this.getDay(); }, + changeMonth() { + var day = new Date(); + day.setTime(this.$refs.datepicker.currDate); + var ym = this.dateToString(day, true); + this.getSummary({start: ym, end: ym}); + this.getDay(day); + }, + dateToString(date, excludeDay) { var year = '' + date.getFullYear(); var month = '' + (date.getMonth() + 1); @@ -208,7 +219,7 @@ export default { } } -#datepicker { +.datepicker { padding: 10px; } @@ -226,11 +237,11 @@ export default { flex: 1; } -.day-info-header, .calendar .prev, .calendar .up, .calendar .next { +.calendar > header > span { background-color: #f8bbd0; } -.calendar:hover .prev:hover, .calendar .up:hover, .calendar .next:hover { +.calendar > header > span:hover { background-color: #f06292 !important; }