HistoryItem.vue 749 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <article class="history item">
  3. <header>
  4. <h1>
  5. <a
  6. :href="item.url"
  7. @click.prevent="onclick"
  8. @keyup.enter="onclick"
  9. v-html="item.textId"
  10. />
  11. </h1>
  12. </header>
  13. <div class="extract" v-html="item.extract" />
  14. </article>
  15. </template>
  16. <script>
  17. import { mapActions } from 'vuex'
  18. export default {
  19. name: 'HistoryItem',
  20. props: {
  21. item: {
  22. type: Object,
  23. required: true
  24. }
  25. },
  26. methods: {
  27. ...mapActions({
  28. navigateToHistoryItem: 'History/navigateToItem'
  29. }),
  30. onclick () {
  31. console.log('clicked on history item', this.item)
  32. this.navigateToHistoryItem(this.item)
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss" scoped>
  38. </style>