ArticleCard.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <article class="card article">
  3. <header>
  4. <h1>
  5. <a
  6. :href="item.view_node"
  7. @click.prevent="onclick"
  8. v-html="item.title"
  9. ></a>
  10. </h1>
  11. <aside v-html="item.created"></aside>
  12. <h4 v-if="false" class="body" v-html="item.body"></h4>
  13. </header>
  14. <section class="images">
  15. <figure v-html="item.field_visuel"></figure>
  16. </section>
  17. </article>
  18. </template>
  19. <script>
  20. // import { JSONAPI } from 'vuejs/api/json-axios'
  21. import router from 'vuejs/route'
  22. let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
  23. export default {
  24. name: "ArticleCard",
  25. router,
  26. props: ['item'],
  27. data(){
  28. return {
  29. alias: this.item.view_node.replace(/^.*\/blabla\//g, '')
  30. }
  31. },
  32. methods:{
  33. onclick(){
  34. console.log('clicked on article', this.alias);
  35. this.$router.push({
  36. name:`article`,
  37. params: { alias:this.alias }
  38. // query: { nid: this.item.nid }
  39. // meta: { uuid:this.item.uuid },
  40. })
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. </style>