History.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <transition name="accordeon" appear>
  3. <div
  4. v-if="opened"
  5. id="history"
  6. class="row"
  7. >
  8. <header class="col-1">
  9. <h2>Historique de consultation</h2>
  10. </header>
  11. <section class="col-10 history-list">
  12. <div class="wrapper">
  13. <ul v-if="items.length">
  14. <li v-for="item in items" :key="item.uuid" class="item">
  15. <HistoryItem :item="item" />
  16. </li>
  17. </ul>
  18. </div>
  19. </section>
  20. <nav class="col-1 tools">
  21. <span
  22. class="mdi mdi-close"
  23. title="close"
  24. @click.prevent="close"
  25. @keydown.enter.prevent="close"
  26. />
  27. </nav>
  28. </div>
  29. </transition>
  30. </template>
  31. <script>
  32. import HistoryItem from '../Content/HistoryItem'
  33. import { mapState } from 'vuex'
  34. export default {
  35. name: 'History',
  36. components: {
  37. HistoryItem
  38. },
  39. computed: {
  40. opened: {
  41. get () { return this.$store.state.History.opened },
  42. set (value) { this.$store.commit('History/setOpened', value) }
  43. },
  44. ...mapState({
  45. items: state => state.History.items
  46. })
  47. },
  48. methods: {
  49. close () {
  50. console.log('clicked on close history')
  51. this.opened = false
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. </style>