longyvfengyun
2023-12-25 d8d792a6842832e8f6af6604274c438b25053afe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<template>
  <div class="dev-type-item">
    <span class="state-light" :class="{'state-list-on':state}"></span>
    <span class="state-text">{{ text }}</span>
    <div class="state-image">
      <img :src="imgSrc" alt="">
    </div>
  </div>
</template>
 
<script>
export default {
  name: "DevTypeItem",
  props: {
    state: {
      type: Boolean,
      default: false,
    },
    text: {
      type: String,
      default: "",
    },
    on: {
      type: String,
      default: ""
    },
    off: {
      type: String,
      default: ""
    },
  },
  data() {
    return {};
  },
  computed: {
    imgSrc() {
      return this.state?this.on:this.off;
    }
  },
}
</script>
 
<style scoped>
.dev-type-item {
  display: inline-block;
  margin-left: 16px;
  margin-right: 16px;
}
.state-light {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #6cb946;
  border-radius: 8px;
  margin-right: 4px;
}
.state-light.state-list-on {
  background-color: #FF3801;
  animation-name: stateOn;
  animation-duration: 1s;
  animation-iteration-count: infinite;
}
.state-text {
  color: #0c2452;
  font-size: 14px;
  font-weight: bold;
}
.state-image {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}
.state-image img {
  width: auto;
  height: 32px;
}
@keyframes stateOn {
  0%   {background-color:#FF3801;}
  50%  {background-color: #673e32;}
  100% {background-color:#FF3801;}
}
</style>