index.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <script lang="ts" setup>
  2. defineProps({
  3. shadow: {
  4. type: String,
  5. default: '',
  6. },
  7. colorFrom: {
  8. type: String,
  9. default: '',
  10. },
  11. colorTo: {
  12. type: String,
  13. default: '',
  14. },
  15. title: {
  16. type: String,
  17. default: '',
  18. },
  19. icon: {
  20. type: String,
  21. default: '',
  22. },
  23. })
  24. </script>
  25. <template>
  26. <el-card
  27. class="vab-colorful-card"
  28. :shadow="shadow"
  29. :style="{
  30. background: `linear-gradient(50deg, ${colorFrom}, ${colorTo})`,
  31. }"
  32. >
  33. <template #header>{{ title }}</template>
  34. <vab-icon v-if="icon" :icon="icon" />
  35. <slot />
  36. </el-card>
  37. </template>
  38. <style lang="scss" scoped>
  39. .vab-colorful-card {
  40. position: relative;
  41. min-height: 120px;
  42. cursor: pointer;
  43. * {
  44. color: var(--el-color-white);
  45. }
  46. :deep() {
  47. .el-card__header {
  48. color: var(--el-color-white);
  49. border-bottom: 0;
  50. }
  51. .el-card__body {
  52. padding-top: 0;
  53. }
  54. }
  55. i {
  56. position: absolute;
  57. top: -30px;
  58. right: 20px;
  59. font-size: 60px;
  60. transform: rotate(15deg);
  61. }
  62. }
  63. </style>