vp-sponsor-large.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <script setup lang="ts">
  2. import { leftCustomImgSponsors } from '../../config/sponsors'
  3. import { sendEvent } from '../../config/analytics'
  4. defineProps({
  5. itemClass: String,
  6. itemStyle: [String, Object, Array],
  7. })
  8. const onItemClick = (item: any) => {
  9. sendEvent('sp_click', item.name, 'left_custom_img')
  10. }
  11. </script>
  12. <template>
  13. <div>
  14. <a
  15. v-for="item in leftCustomImgSponsors"
  16. :key="item.name"
  17. :href="item.url"
  18. :title="`${item.name_cn || item.name} - ${item.slogan_cn || item.slogan}`"
  19. :class="['sponsor-item inline-flex', itemClass]"
  20. :style="itemStyle"
  21. target="_blank"
  22. @click="onItemClick(item)"
  23. >
  24. <img :src="item.banner_img" :alt="item.name" />
  25. </a>
  26. </div>
  27. </template>
  28. <style scoped lang="scss">
  29. @use '../styles/mixins.scss' as *;
  30. .sponsor-item {
  31. margin-bottom: 8px;
  32. height: 60px;
  33. width: 196px;
  34. @include respond-to('max') {
  35. width: 236px;
  36. height: 72px;
  37. }
  38. @media (max-width: 767px) {
  39. width: 236px;
  40. height: 72px;
  41. }
  42. img {
  43. border-radius: 8px;
  44. overflow: hidden;
  45. height: 100%;
  46. width: 100%;
  47. }
  48. }
  49. @media (max-width: 768px) {
  50. .sponsor-item {
  51. img {
  52. border-radius: 4px;
  53. min-height: 45px;
  54. }
  55. }
  56. }
  57. </style>