Feat: display months in home
This commit is contained in:
parent
bdca2dc0a0
commit
caaefc0972
29
src/components/months.vue
Normal file
29
src/components/months.vue
Normal file
@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div id="months">
|
||||
<ul>
|
||||
<li v-for="month in months" :key="month.date">
|
||||
{{ month }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'months',
|
||||
props: {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
months: "travail/months",
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -71,7 +71,9 @@ const travail = {
|
||||
},
|
||||
getters: {
|
||||
count (state) {return state.months.length},
|
||||
months (state) {return state.months},
|
||||
months (state) {
|
||||
return state.months.sort((a, b) => new Date(b.date) - new Date(a.date))
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
}
|
||||
|
@ -1,24 +1,30 @@
|
||||
<template>
|
||||
<h1>Home</h1>
|
||||
<p> {{ state }} </p>
|
||||
<section>
|
||||
<h2> Mois </h2>
|
||||
<months></months>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import months from '../components/months'
|
||||
export default {
|
||||
name: 'home',
|
||||
components: {},
|
||||
components: {
|
||||
months: months
|
||||
},
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
state: "datas/count",
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
})
|
||||
computed: {
|
||||
...mapGetters({
|
||||
state: "datas/count",
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user