analysis-card-item.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view class="analysis-card-item">
  3. <view class="analysis-card-title">
  4. <slot name="title"></slot>
  5. </view>
  6. <view class="analysis-card-title" v-if="isSubtitle">
  7. <slot name="subtitle"></slot>
  8. </view>
  9. <view class="analysis-card-num">
  10. <count-up
  11. :num="num"
  12. :width="24"
  13. :height="56"
  14. :fontSize="40"
  15. color="#333333"/>
  16. <text v-if="isPercentage">%</text>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import countUp from './countUp.vue'
  22. export default {
  23. components: {
  24. countUp
  25. },
  26. props: {
  27. isPercentage: {
  28. type: Boolean,
  29. default: false
  30. },
  31. isSubtitle: {
  32. type: Boolean,
  33. default: false
  34. },
  35. num: {
  36. type: Number,
  37. default: 60
  38. }
  39. },
  40. }
  41. </script>
  42. <style lang="scss">
  43. .analysis-card-item {
  44. display: flex;
  45. flex-direction: column;
  46. justify-content: center;
  47. height: 210rpx;
  48. align-items: center;
  49. box-sizing: border-box;
  50. .analysis-card-num {
  51. color: #333333;
  52. font-weight: bold;
  53. font-size: 40rpx;
  54. display: flex;
  55. align-items: center;
  56. }
  57. }
  58. .analysis-card-title {
  59. margin-bottom: 16rpx;
  60. }
  61. .analysis-card-title:nth-child(1) {
  62. font-size: 28rpx;
  63. color: #333333;
  64. }
  65. .analysis-card-title:nth-child(2) {
  66. font-size: 24rpx;
  67. color: #999999;
  68. }
  69. </style>