OperumItem.vue 871 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <article class="operum item">
  3. <header>
  4. <h1>
  5. <a
  6. v-if="item.uuid"
  7. :href="item.url"
  8. @click.prevent="onclick"
  9. @keyup.enter="onclick"
  10. >
  11. {{ item.title }}
  12. </a>
  13. <span v-else class="red">
  14. {{ item.title }}
  15. </span>
  16. </h1>
  17. </header>
  18. </article>
  19. </template>
  20. <script>
  21. export default {
  22. name: 'OperumItem',
  23. props: {
  24. item: {
  25. type: Object,
  26. required: true
  27. }
  28. },
  29. data: () => ({
  30. }),
  31. methods: {
  32. onclick () {
  33. console.log('clicked on Operum item', this.item)
  34. if (this.item.uuid) {
  35. this.$router.push({
  36. name: `operum`,
  37. params: { id: this.item.uuid }
  38. })
  39. } else {
  40. console.warn('no uuid', this.item)
  41. }
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. </style>