index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <el-col :span="24" class="energy modular">
  3. <el-col class="title">能源</el-col>
  4. <el-col class="left">
  5. <el-col class="itemWrap" :span="12" v-for="(item , index) in list" :key="index">
  6. <el-col class="item" :span="12" >
  7. <el-col class="img" :span="8">
  8. <el-image :src="`/assets/svg/energy${index}.svg`" class="img" v-if="loading"> </el-image>
  9. </el-col>
  10. <el-col class="attribute" :span="16">
  11. <el-col class="name">{{item.name1}}</el-col>
  12. <el-col class="value">{{item.num}}</el-col>
  13. </el-col>
  14. </el-col>
  15. <el-col class="item" :span="12">
  16. <el-col class="img" :span="8">
  17. <el-image :src="`/assets/svg/energy${index}.svg`" class="img" v-if="loading"> </el-image>
  18. </el-col>
  19. <el-col class="attribute" :span="16">
  20. <el-col class="name">{{item.name2}}</el-col>
  21. <el-col class="value" v-if="loading">{{Math.abs(item.compare)}}%
  22. <el-image :src="`/assets/svg/xj.svg`" class="compare fill1" v-if="item.compare < 0 " />
  23. <el-image :src="`/assets/svg/ss.svg`" class="compare fill2" v-if="item.compare >= 0" />
  24. </el-col>
  25. </el-col>
  26. </el-col>
  27. </el-col>
  28. </el-col>
  29. </el-col>
  30. </template>
  31. <script setup name="Dept">
  32. const props = defineProps({
  33. resData: Object,
  34. })
  35. const list = props.resData
  36. const loading = ref(false)
  37. setTimeout(()=>{
  38. loading.value = ref(true)
  39. },800)
  40. </script>
  41. <style lang="scss" scoped >
  42. .energy{
  43. width:626px;
  44. height:270px;
  45. overflow: hidden;
  46. box-sizing: border-box;
  47. .left{
  48. width:100%;
  49. display: inline-block;
  50. .itemWrap{
  51. .item{
  52. padding:0px 0;
  53. overflow: hidden;
  54. .img{
  55. width:20px;
  56. height:20px;
  57. margin:5px 8px 0 3px;
  58. display: inline-block;
  59. vertical-align: middle;
  60. position: relative;
  61. left: -80px;
  62. filter: drop-shadow(#ffffff 80px 0); //设置颜色,并将阴影偏移至未溢出区域
  63. -webkit-filter: drop-shadow(#fff 80px 0);
  64. }
  65. .attribute{
  66. vertical-align: middle;
  67. display: inline-block;
  68. .name{
  69. font-size: 11px;
  70. }
  71. .value{
  72. font-size: 14px;
  73. margin-top:5px;
  74. font-weight: 700;
  75. display: inline-block;
  76. overflow: hidden;
  77. span{
  78. font-size: 8px;
  79. }
  80. .compare{
  81. font-size: 10px !important;
  82. width:15px;
  83. height:20px;
  84. display: inline-block;
  85. margin-left:10px;
  86. vertical-align: middle;
  87. }
  88. .fill1{
  89. position: relative;
  90. left: -80px;
  91. filter: drop-shadow(red 80px 0); //设置颜色,并将阴影偏移至未溢出区域
  92. -webkit-filter: drop-shadow(red 80px 0);
  93. }
  94. .fill2{
  95. position: relative;
  96. left: -80px;
  97. filter: drop-shadow(green 80px 0); //设置颜色,并将阴影偏移至未溢出区域
  98. -webkit-filter: drop-shadow(green 80px 0);
  99. }
  100. }
  101. .introduce{
  102. font-size: 10px !important;
  103. width:15px;
  104. height:20px;
  105. display: inline-block;
  106. margin-left:10px;
  107. vertical-align: middle;
  108. }
  109. }
  110. }
  111. .item:nth-child(2){
  112. border-right:1px solid rgba(255,255,255,.1);
  113. }
  114. }
  115. .itemWrap:nth-child(1),.itemWrap:nth-child(2){
  116. margin-top:0px;
  117. }
  118. .itemWrap:nth-child(3),.itemWrap:nth-child(4){
  119. margin-top:60px;
  120. }
  121. .itemWrap:nth-child(2),.itemWrap:nth-child(4){
  122. .item:nth-child(2){
  123. border-right:none;
  124. }
  125. }
  126. }
  127. }
  128. </style>