HorAirSwitch.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div class="airSwitch horizontalClass">
  3. <div class="head-title">
  4. <span>空调实时开关</span>
  5. </div>
  6. <div class="air-status" v-bind:class="{'close':!status}">
  7. <span>{{status ? "空调已开启" : "空调已关闭"}}</span>
  8. </div>
  9. <div class="air-bg" >
  10. <img :src="[status ? img.openImg : img.closeImg]" />
  11. </div>
  12. <div class="air-rate">
  13. <span>空调开启率</span>
  14. <span class="air-rate-value">{{value}}%</span>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import air_open from '@/assets/horImg/air_open.png';
  20. import air_close from '@/assets/horImg/air_close.png';
  21. export default {
  22. name: "AirSwitch",
  23. props: {
  24. status: {
  25. type: Boolean,
  26. default: () => { return false } // 默认开
  27. },
  28. value: {
  29. type: Number,
  30. default: () => { return 75 } // 默认开
  31. },
  32. },
  33. data() {
  34. return {
  35. img: {
  36. openImg: air_open,
  37. closeImg: air_close,
  38. }
  39. }
  40. },
  41. }
  42. </script>
  43. <style lang="less" scoped>
  44. .airSwitch {
  45. height: 388px;
  46. // width: 446px;
  47. .air-status {
  48. margin-top: 8px;
  49. height: 20px;
  50. width: 86px;
  51. border-radius: 4px;
  52. background: rgba(126, 216, 116, 1);
  53. // padding: 2px 8px;
  54. box-sizing: border-box;
  55. color: #ffffff;
  56. font-weight: 600;
  57. line-height: 20px;
  58. text-align: center;
  59. font-size: 14px;
  60. &.close {
  61. background: rgba(155, 152, 173, 1);
  62. }
  63. }
  64. .air-bg {
  65. padding-top: 36px;
  66. height: 250px;
  67. box-sizing: border-box;
  68. text-align: center;
  69. }
  70. .air-rate {
  71. font-weight: 400;
  72. line-height: 20px;
  73. color: #575271;
  74. .air-rate-value {
  75. color: #3b3558;
  76. font-family: Persagy;
  77. font-size: 20px;
  78. font-weight: 700;
  79. line-height: 24px;
  80. }
  81. }
  82. }
  83. </style>