Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <template>
  2. <div class="col-md-3">
  3. <div class="thumbnail">
  4. <a :href="src">
  5. <img :src="src">
  6. </a>
  7. <div class="caption">
  8. <h4>{{ post.make }}</h4>
  9. <h4>{{ post.model }}</h4>
  10. <h4>{{ userName }}</h4>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15.  
  16. <script>
  17. export default {
  18. props:{
  19. post:{
  20. type: Object,
  21. required: true
  22. }
  23. },
  24. data() {
  25. return {
  26. src:'',
  27. make: '',
  28. model: '',
  29. userName: ''
  30. }
  31. },
  32. mounted(){
  33. if (this.post.make !== null) {
  34. this.make = this.post.make
  35. };
  36. if (this.post.model !== null) {
  37. this.model = this.post.model
  38. };
  39. if (this.post.user !== null) {
  40. this.userName = this.post.user.name;
  41. }
  42. }
  43. }
  44. </script>
  45.  
  46. <template>
  47. <div class="col-md-3">
  48. <div class="thumbnail">
  49. <a :href="src">
  50. <img :src="src">
  51. </a>
  52. <div class="caption">
  53. <h4 v-if="post.make">{{ post.make }}</h4>
  54. <h4 v-if="post.model">{{ post.model }}</h4>
  55. <h4 v-if="post.price" style="color:red;">{{ post.price }}</h4>
  56. <h4 v-if="post.user">{{ post.user.name }}</h4>
  57. </div>
  58. </div>
  59. </div>
  60. </template>
  61.  
  62. <script>
  63. export default {
  64. props:{
  65. post:{
  66. type: Object,
  67. required: true
  68. }
  69. },
  70. data() {
  71. return {
  72. src:''
  73. }
  74. },
  75. mounted(){
  76. if (this.post.photos == 0 || this.post.photos === null) {
  77. return this.src = '/images/post-thumbnail.png'
  78. };
  79. this.src = '/storage/' + this.post.photos[0].name;
  80. }
  81. }
  82. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement