DataItem.vue 1.6 KB

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