AirSwitch.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="airSwitch">
  3. <div class="air-title">
  4. <span>空调实时开关</span>
  5. </div>
  6. <div class="air-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_close from '@/assets/horImg/air_open.png';
  20. import air_open from '@/assets/horImg/air_close.png';
  21. export default {
  22. name: "AirSwitch",
  23. props: {
  24. status: {
  25. type: Boolean,
  26. default: () => { return true } // 默认开
  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. padding: 24px 32px;
  46. height: 388px;
  47. width: 448px;
  48. border-radius: 20px;
  49. border: 2px solid #ffffff;
  50. background: #ffffffcc;
  51. .air-title {
  52. font-size: 20px;
  53. font-weight: 600;
  54. line-height: 28px;
  55. color: #3b3558;
  56. }
  57. .air-status {
  58. margin-top: 8px;
  59. height: 24px;
  60. width: 86px;
  61. border-radius: 4px;
  62. padding: 2px, 8px, 2px, 8px;
  63. background: rgba(126, 216, 116, 1);
  64. padding: 2px 8px;
  65. box-sizing: border-box;
  66. color: #ffffff;
  67. font-weight: 600;
  68. line-height: 20px;
  69. text-align: center;
  70. &.close {
  71. background: rgba(155, 152, 173, 1);
  72. }
  73. }
  74. .air-bg {
  75. padding-top: 36px;
  76. padding-bottom: 54px;
  77. text-align: center;
  78. }
  79. .air-rate {
  80. font-weight: 400;
  81. line-height: 20px;
  82. color: #575271;
  83. .air-rate-value {
  84. color: #3b3558;
  85. font-family: Persagy;
  86. font-size: 20px;
  87. font-weight: 700;
  88. line-height: 24px;
  89. }
  90. }
  91. }
  92. </style>