trans_card.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div class="item flex-column-align-center" :style="{width: itemWidth + 'px', height: height + 'px'}" @click="showDetail(item, index)">
  3. <image class="super" :src="LEVEL_MAP[item.level].bg" mode="scaleToFill" :style="{width: width + 'px', left: fill + 'px'}" />
  4. <image class="image" :src="item.cover" mode="aspectFit" :style="{width: imageWidth + 'px', height: imageHeight + 'px'}" />
  5. </div>
  6. </template>
  7. <script>
  8. import { LEVEL_MAP } from '@/utils/config'
  9. export default {
  10. props: {
  11. item: Object,
  12. width: {
  13. type: Number,
  14. default: 67
  15. },
  16. height: {
  17. type: Number,
  18. default: 90
  19. },
  20. fill: {
  21. type: Number,
  22. default: 2
  23. },
  24. imageWidth: {
  25. type: Number,
  26. default: 55
  27. },
  28. imageHeight: {
  29. type: Number,
  30. default: 70
  31. }
  32. },
  33. data() {
  34. return {
  35. LEVEL_MAP,
  36. itemWidth: 0
  37. }
  38. },
  39. created() {
  40. this.itemWidth = this.width + this.fill * 2
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .item {
  46. position: relative;
  47. .super {
  48. position: absolute;
  49. top: 0;
  50. height: 100%;
  51. }
  52. }
  53. </style>