videoCard.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="video-card" >
  3. <div class="img-box">
  4. <img :src="cardData.imgUrl">
  5. <i @click="cardClick"></i>
  6. </div>
  7. <h4 v-if="cardData.title">{{cardData.title}}</h4>
  8. <p v-if="cardData.des">{{cardData.des}}</p>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name: "videoCard",
  14. props: {
  15. cardData: {
  16. type: Object,
  17. default: () => ({})
  18. }
  19. },
  20. methods: {
  21. cardClick() {
  22. this.$emit('card-click', this.cardData)
  23. }
  24. }
  25. }
  26. </script>
  27. <style lang="scss" scoped>
  28. .video-card {
  29. width: 370px;
  30. height: 210px;
  31. .img-box {
  32. position: relative;
  33. background: greenyellow;
  34. width: inherit;
  35. height: inherit;
  36. overflow: hidden;
  37. img {
  38. width: 100%;
  39. height: 100%;
  40. transition: all .5s ease;
  41. }
  42. &:hover{img{transform: scale(1.1);}}
  43. i {
  44. position: absolute;
  45. left: 50%;
  46. top: 50%;
  47. transform: translate(-30px,-30px);
  48. display: inline-block;
  49. width: 60px;
  50. height: 60px;
  51. background-image: url("~static/images/client/course/course-video-icon.svg");
  52. background-repeat: no-repeat;
  53. cursor: pointer;
  54. }
  55. }
  56. h4 {
  57. font-size: 24px;
  58. font-weight: 800;
  59. color: #333;
  60. text-align: center;
  61. margin-top: 25px;
  62. }
  63. p {
  64. font-size: 16px;
  65. font-weight: 500;
  66. color: #333;
  67. text-align: center;
  68. margin-top: 25px;
  69. }
  70. }
  71. @media (max-width: 768px) {
  72. .video-card {
  73. width: 100%;
  74. height: 100%;
  75. .img-box {
  76. position: relative;
  77. background: greenyellow;
  78. width: inherit;
  79. height: inherit;
  80. overflow: hidden;
  81. img {
  82. width: 100%;
  83. min-height: 160px;
  84. transition: all .5s ease;
  85. }
  86. }
  87. h4 {
  88. font-size: 16px;
  89. font-weight: 800;
  90. color: #333;
  91. text-align: center;
  92. margin-top: 15px;
  93. }
  94. p {
  95. font-size: 12px;
  96. font-weight: 500;
  97. color: #333;
  98. text-align: center;
  99. margin-top: 15px;
  100. }
  101. }
  102. }
  103. </style>