index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!--
  2. * @Author: wjc
  3. * @Date: 2025-12-01 17:22:12
  4. * @LastEditors: wjc
  5. * @LastEditTime: 2025-12-12 15:38:59
  6. * @Description:
  7. -->
  8. <template>
  9. <div class="card">
  10. <div class="card-header">
  11. <div class="card-lf">
  12. <img :src="icon" alt="icon" class="icon"/>
  13. <span class="title">{{ title }}</span>
  14. <span v-if="subTitle" class="sub-title">({{subTitle}})</span>
  15. </div>
  16. <div v-if="unit" class="unit">{{ unit }}</div>
  17. </div>
  18. <div class="card-body">
  19. <slot></slot>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. name: 'card',
  26. props: {
  27. title: {
  28. type: String,
  29. default: ''
  30. },
  31. subTitle: {
  32. type: String,
  33. default: ''
  34. },
  35. unit: {
  36. type: String,
  37. default: ''
  38. },
  39. icon: {
  40. type: String,
  41. default: ''
  42. }
  43. }
  44. }
  45. </script>
  46. <style scoped lang="scss">
  47. @import '@/assets/css/function.scss';
  48. @import '@/assets/css/theme.scss';
  49. .card {
  50. width: 100%;
  51. height: 100%;
  52. box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.4);
  53. border-radius: var(--radius);
  54. background: linear-gradient(180deg, rgba(14,22,41,1) 0%,rgba(14,22,41,0.6) 100%);
  55. .card-header{
  56. display: flex;
  57. justify-content: space-between;
  58. align-items: center;
  59. color: rgba(185, 227, 244, 1);
  60. font-size: halfW(16);
  61. padding: halfH(4) halfW(10);
  62. background: var(--title-bg);
  63. border-radius: var(--radius);
  64. .title{
  65. display: inline-block;
  66. vertical-align: middle;
  67. }
  68. .icon{
  69. width: halfW(28);
  70. height: halfW(28);
  71. vertical-align: middle;
  72. margin-right: halfW(8);
  73. }
  74. .sub-title{
  75. font-size: halfW(12);
  76. }
  77. .unit {
  78. font-size: halfW(12);
  79. color: #818181;
  80. }
  81. }
  82. .card-body{
  83. padding: halfH(16) halfW(10);
  84. box-sizing: border-box;
  85. height: calc(100% - halfH(8) - halfH(16) - halfW(28));
  86. }
  87. }
  88. </style>