Feat: selecting a year is working
This commit is contained in:
parent
acab0a9d68
commit
4ddfa1654f
@ -4,7 +4,7 @@
|
||||
<h2>
|
||||
<ul id="years">
|
||||
<li v-for="year in years" :key="year">
|
||||
<span @click="select_year(year)" :class="{selected_year:year==current_year}">{{ year }}</span>
|
||||
<span @click="selectYear(year)" :class="{selected_year:year==current_year}">{{ year }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</h2>
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { mapActions } from 'vuex'
|
||||
import { getYear } from 'date-fns'
|
||||
const today = new Date()
|
||||
export default {
|
||||
@ -33,6 +34,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
current_year: getYear(today),
|
||||
current_date: today,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -41,8 +43,15 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
select_year: function (year) {
|
||||
this.current_year=year
|
||||
...mapActions('travail', {
|
||||
'setRange': 'setRange',
|
||||
}),
|
||||
selectYear: function (year) {
|
||||
this.current_year=year
|
||||
this.setRange({
|
||||
start: `${this.current_year}-01`,
|
||||
end: `${this.current_year}-12`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user