HyCard.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view
  3. class="hy-card-container"
  4. :class="isBg ? 'bg-card' : ''"
  5. :style="{ marginBottom: marginBottom + 'rpx', backgroundImage: isBg ? 'url(' + bgImg + ')' : 'none' }"
  6. >
  7. <view class="main-title-box" v-if="title">
  8. <view class="text">{{ title }}</view>
  9. <view v-if="isShowRight" class="right-text-wrap">
  10. <text>{{ rightText }}</text>
  11. <u-icon name="arrow-right-double" size="21" color="#292e36"></u-icon>
  12. </view>
  13. </view>
  14. <slot></slot>
  15. </view>
  16. </template>
  17. <script lang="ts" setup>
  18. import { ref } from 'vue'
  19. const props = defineProps({
  20. title: {
  21. type: String,
  22. default: ''
  23. },
  24. marginBottom: {
  25. type: Number,
  26. default: 24
  27. },
  28. isShowRight: {
  29. type: Boolean,
  30. default: false
  31. },
  32. rightText: {
  33. type: String,
  34. default: '更多'
  35. },
  36. isBg: {
  37. type: Boolean,
  38. default: false
  39. },
  40. bgImg: {
  41. type: String,
  42. default: ''
  43. }
  44. })
  45. </script>
  46. <style lang="scss" scoped>
  47. .hy-card-container {
  48. width: 100%;
  49. box-sizing: border-box;
  50. padding: 22rpx;
  51. background-color: #fff;
  52. border-radius: 14rpx;
  53. &.bg-card {
  54. width: 100%;
  55. min-height: 549rpx;
  56. background-position: center center;
  57. background-size: 100% 100%;
  58. background-repeat: no-repeat;
  59. }
  60. .main-title-box {
  61. display: flex;
  62. align-items: center;
  63. justify-content: space-between;
  64. .text {
  65. font-size: 31rpx;
  66. color: #333;
  67. font-weight: 600;
  68. }
  69. .right-text-wrap {
  70. display: flex;
  71. align-items: center;
  72. text {
  73. font-size: 21rpx;
  74. color: #292e36;
  75. }
  76. }
  77. }
  78. }
  79. </style>