weather.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="weather">
  3. <div class="weather-info">
  4. <span class="svg-icon">
  5. <svg-icon class="weather-icon" :svgid="'svg-' + sourceMap.tqtp" />
  6. </span>
  7. <div>
  8. <div class="temperature">{{ sourceMap.wd }} °</div>
  9. <div class="other">
  10. <span>{{ sourceMap.tqmc }}</span>
  11. <span>{{ sourceMap.fx }}</span>
  12. <span>{{ sourceMap.fs }}</span>
  13. </div>
  14. </div>
  15. </div>
  16. <div class="other-info">
  17. <Row>
  18. <Col>
  19. <div class="svg-icon svg-icon-sm svg-icon-green other-icon">
  20. <svg-icon svgid="svg-能见度" />
  21. </div>
  22. <div class="value">{{ sourceMap.qxd }}</div>
  23. <div class="text">能见度</div>
  24. </Col>
  25. <Col>
  26. <div class="svg-icon svg-icon-sm svg-icon-green other-icon">
  27. <svg-icon svgid="svg-湿度" />
  28. </div>
  29. <div class="value">{{ sourceMap.sd }}</div>
  30. <div class="text">湿度</div>
  31. </Col>
  32. <Col>
  33. <div class="svg-icon svg-icon-sm svg-icon-green other-icon">
  34. <svg-icon svgid="svg-气压" />
  35. </div>
  36. <div class="value">{{ sourceMap.dqyl }}kPa</div>
  37. <div class="text">气压</div>
  38. </Col>
  39. <Col>
  40. <div class="svg-icon svg-icon-sm svg-icon-green other-icon">
  41. <svg-icon svgid="svg-日出" />
  42. </div>
  43. <div class="value">{{ sourceMap.richushijian }}</div>
  44. <div class="text">日出时间</div>
  45. </Col>
  46. <Col>
  47. <div class="svg-icon svg-icon-sm svg-icon-green other-icon">
  48. <svg-icon svgid="svg-日落" />
  49. </div>
  50. <div class="value">{{ sourceMap.riluoshijian }}</div>
  51. <div class="text">日落时间</div>
  52. </Col>
  53. </Row>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import Col from "@/components/coms/grid/col.vue";
  59. import Row from "@/components/coms/grid/row.vue";
  60. import SvgIcon from "../../../components/coms/icon/svg-icon.vue";
  61. export default {
  62. components: { Row, Col, SvgIcon },
  63. props:{
  64. data:{
  65. type:Object,
  66. default:() => { }
  67. }
  68. },
  69. // 数据自己获取天气情况
  70. data() {
  71. return {
  72. sourceMap:{},
  73. weather: "阴", // 气象
  74. temperature: "11", // 温度
  75. windDirection: "北风", // 风向
  76. windSpeed: "3-4级", // 风速
  77. visibility: "20KM", //能见度
  78. humidity: "75.0%", // 湿度
  79. pressure: "994kPa", // 气压
  80. sunrise: "08:10", // 日出
  81. sunset: "17:39", // 日落
  82. };
  83. },
  84. mounted(){
  85. this.sourceMap=this.data;
  86. },
  87. watch:{
  88. data(res){
  89. this.sourceMap=res;
  90. }
  91. }
  92. };
  93. </script>
  94. <style lang="less" scoped>
  95. .weather {
  96. .weather-info {
  97. display: flex;
  98. margin-bottom: 1.481vh;
  99. .weather-icon {
  100. width: 5.5556vh;
  101. height: 5.5556vh;
  102. margin: 0 1.481vh;
  103. }
  104. .temperature {
  105. font-size: 2.778vh;
  106. }
  107. .other span {
  108. font-size: @fontsize-s;
  109. margin-right: 2.222vh;
  110. }
  111. }
  112. .other-info {
  113. text-align: center;
  114. font-size: @fontsize-s;
  115. .text {
  116. color: @font-color;
  117. font-size: 12px;
  118. margin-bottom: 8px;
  119. }
  120. .value {
  121. margin: 8px 0;
  122. }
  123. .other-icon {
  124. margin: 0 auto;
  125. }
  126. }
  127. }
  128. </style>