ResultItem.vue 849 B

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