pilotLamp.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="pilotLamp">
  3. <view
  4. class="item"
  5. :style="{ width: itemW }"
  6. v-for="item in list"
  7. :key="item.name"
  8. >
  9. <view class="image">
  10. <image
  11. style="height: 100%"
  12. src="/static/img/pilot-lamp.png"
  13. mode="heightFix"
  14. />
  15. <view v-if="item.value" class="bg" />
  16. </view>
  17. <view class="name">
  18. {{ item.name }}
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name: "pilotLamp",
  26. props: {
  27. itemW: {
  28. type: String,
  29. default: "20%",
  30. },
  31. },
  32. data() {
  33. return {
  34. list: [],
  35. };
  36. },
  37. };
  38. </script>
  39. <style lang="scss" scoped>
  40. .pilotLamp {
  41. display: flex;
  42. flex-wrap: wrap;
  43. .item {
  44. display: flex;
  45. flex-direction: column;
  46. align-items: center;
  47. .image {
  48. position: relative;
  49. height: 20px;
  50. .bg {
  51. width: 14px;
  52. height: 14px;
  53. border-radius: 50%;
  54. background: #cccccc;
  55. position: absolute;
  56. top: 3px;
  57. left: 3px;
  58. animation: lampBackground 0.5s infinite alternate ease-in-out;
  59. }
  60. @keyframes lampBackground {
  61. from {
  62. background-color: #ff8f4a;
  63. }
  64. to {
  65. background-color: red;
  66. }
  67. }
  68. }
  69. .name {
  70. font-size: 12px;
  71. color: #fff;
  72. margin-top: 6px;
  73. }
  74. }
  75. .item:nth-of-type(n + 6) {
  76. margin-top: 10px;
  77. }
  78. }
  79. </style>