index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div v-if="item" class="dataItem flex-center-start" :style="{ background: item.bgColor, padding: item.padding, alignItems: item.type === 'circle' && 'baseline' }">
  3. <div v-if="item.type === 'circle'" class="circle" :style="{ background: item.color }" />
  4. <addIcon v-else :inner-color="item.innerColor" :out-color="item.outColor" />
  5. <div class="textWord ellipsis">
  6. <div>
  7. <span :style="{color: item.labelColor ? item.labelColor : '#666'}">{{ item.label }}</span>
  8. <span class="title isHove">{{ item.title }}</span>
  9. <span>{{ item.titleUnit }}</span>
  10. <span v-if="item.remark" class="remark">({{ item.remark }})</span>
  11. </div>
  12. <!-- <div class="ellipsis" v-html="subTitle" /> -->
  13. <div class="subTitleName">
  14. <span v-if="item.subTitleUnit === 'rate'">
  15. <span>环比:</span>
  16. <span :class="Number(item.subTitle) > 0 ? 'item-up isHove' : 'item-down isHove'">
  17. <i v-if="Number(item.subTitle) > 0" class="el-icon-caret-top" />
  18. <i v-else class="el-icon-caret-bottom" />
  19. {{ item.subTitle }}%
  20. </span>
  21. </span>
  22. <span v-else style="font-weight: 600" v-html="item.subTitle" />
  23. </div>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import addIcon from '@/components/addIcon'
  29. export default {
  30. components: {
  31. addIcon
  32. },
  33. props: {
  34. item: {
  35. type: Object,
  36. required: false,
  37. default: () => {}
  38. },
  39. type: {
  40. type: String,
  41. required: false,
  42. default: 'addIcon'
  43. }
  44. }
  45. }
  46. </script>
  47. <style scoped lang='less'>
  48. .dataItem {
  49. border-radius: 6px;
  50. padding: 8px 6px;
  51. color: #666;
  52. .circle {
  53. width: 6px;
  54. height: 6px;
  55. border-radius: 3px;
  56. }
  57. .textWord {
  58. padding-left: 4px;
  59. width: 90%;
  60. .remark {
  61. font-size: 12px;
  62. }
  63. .title {
  64. color: #333;
  65. font-size: 14px;
  66. font-weight: 600;
  67. }
  68. .subTitleName {
  69. color: #999;
  70. font-size: 12px;
  71. .item-up {
  72. color:#F32850;
  73. font-weight: 600;
  74. }
  75. .item-down {
  76. //color:#9FFF39
  77. color:#7Ed321;
  78. font-weight: 600;
  79. }
  80. }
  81. }
  82. }
  83. </style>