videoCard.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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" :title="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: 230px;
  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. width: 100%;
  63. text-overflow: ellipsis;
  64. -o-text-overflow: ellipsis;
  65. overflow: hidden;
  66. word-wrap: break-word;
  67. white-space: nowrap;
  68. }
  69. p {
  70. font-size: 16px;
  71. font-weight: 500;
  72. color: #333;
  73. text-align: center;
  74. margin-top: 25px;
  75. }
  76. }
  77. @media (max-width: 768px) {
  78. .video-card {
  79. width: 100%;
  80. height: 100%;
  81. .img-box {
  82. position: relative;
  83. background: greenyellow;
  84. width: inherit;
  85. height: inherit;
  86. overflow: hidden;
  87. img {
  88. width: 100%;
  89. min-height: 160px;
  90. transition: all .5s ease;
  91. }
  92. }
  93. h4 {
  94. font-size: 16px;
  95. font-weight: 800;
  96. color: #333;
  97. text-align: center;
  98. margin-top: 15px;
  99. }
  100. p {
  101. font-size: 12px;
  102. font-weight: 500;
  103. color: #333;
  104. text-align: center;
  105. margin-top: 15px;
  106. }
  107. }
  108. }
  109. </style>