Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

msgCard.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Vue.component('MsgCard', {
  2. template: `<div class="om-card card">
  3. <h6 class="msg-head">
  4. <b>{{ msg.subject }}</b>
  5. <img src="favicon.ico" width=20px height=20px>
  6. </h6>
  7. {{ msg.message }}<br><br>
  8. <a href="#">{{ msg.tag }}</a></p>
  9. <div class="om-card-footer"> <div class="om-user-line">
  10. <i class="material-icons">account_circle</i>
  11. Erstellt von {{ msg.user }}</div>
  12. <a href="#" v-if="isFavorited" @click.prevent="unFavorite(post)">
  13. <i class="material-icons">bookmark_border</i></a>
  14. <a href="#" v-else @click.prevent="favorite(post)">
  15. <i class="bookmark"></i>
  16. </a>
  17. </div></div>`,
  18. props: ['msg'],
  19. // props: ['post', 'favorited'],
  20. data: function () {
  21. return {
  22. // isFavorited: '',
  23. };
  24. },
  25. /* mounted() {
  26. this.isFavorited = this.isFavorite ? true : false;
  27. },
  28. computed: {
  29. isFavorite() {
  30. return this.favorited;
  31. },
  32. },*/
  33. methods: {
  34. /* favorite(post) {
  35. $.ajax({url: "api/ids", method: "POST"})
  36. .then(response => this.isFavorited = true)
  37. .catch(response => console.log(response.data));
  38. },
  39. unFavorite(post) {
  40. $.ajax({url: "api/ids", method: "POST"})
  41. .then(response => this.isFavorited = false)
  42. .catch(response => console.log(response.data));
  43. }*/
  44. },
  45. });