DataItem.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="data-item" :style="{ backgroundColor: dataItem.bg, border: '1rpx solid ' + dataItem.bg }">
  3. <view class="data-item-title">{{ dataItem.title }}</view>
  4. <view class="data-item-value" :style="{ color: dataItem.valueColor }">{{ dataItem.value }}</view>
  5. <view class="data-item-desc">
  6. <image v-if="globalImages" :src="globalImages + 'imgs/' + dataItem.status === 'up' ? 'haoyou' : 'shuangyue' + '.png'" style="width: 21rpx;height: 25rpx;"></image>
  7. <text style="margin: 0 8rpx;">{{ dataItem.fluctuate }}</text>
  8. <text>较昨日</text>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. props: {
  15. dataItem: {
  16. type: Object,
  17. default: () => {
  18. return { title: '订单总量', value: '1248', status: 'up', fluctuate: '12.5%', bg: '#E8FBF6', valueColor: '#00C18A' }
  19. }
  20. },
  21. globalImages: {
  22. type: String,
  23. require: true
  24. },
  25. },
  26. data() {
  27. return {}
  28. },
  29. }
  30. </script>
  31. <style lang="scss">
  32. .data-item {
  33. width: 100%;
  34. height: 100%;
  35. padding: 32rpx;
  36. box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.05);
  37. border-radius: 16rpx;
  38. box-sizing: border-box;
  39. .data-item-title {
  40. font-size: 28rpx;
  41. line-height: 40rpx;
  42. color: #333333;
  43. font-weight: 500;
  44. }
  45. .data-item-value {
  46. margin: 8rpx 0;
  47. font-weight: 700;
  48. font-size: 48rpx;
  49. line-height: 64rpx;
  50. }
  51. .data-item-desc {
  52. font-size: 24rpx;
  53. line-height: 32rpx;
  54. color: #333333;
  55. }
  56. }
  57. </style>