he wei
2025-04-03 c6a2d2debf161b987ff91c6ac9560d10fc98c54b
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<template>
  <svg class="svg" viewBox="0 0 80 160">
    <g id="display" :style="{ '--color': color }">
      <polygon
        :class="['digit', { active: activeList.indexOf('f') > -1 }]"
        points="0,2 20,22 20,68 0,78"
        fill="none"
        stroke="black"
      />
      <polygon
        :class="['digit', { active: activeList.indexOf('e') > -1 }]"
        points="0,82 20,92 20,138 0,158"
        fill="none"
        stroke="black"
      />
      <polygon
        :class="['digit', { active: activeList.indexOf('a') > -1 }]"
        points="2,0 78,0 58,20 22,20"
        fill="none"
        stroke="black"
      />
      <polygon
        :class="['digit', { active: activeList.indexOf('b') > -1 }]"
        points="80,2 60,22 60,68 80,78"
        fill="none"
        stroke="black"
      />
      <polygon
        :class="['digit', { active: activeList.indexOf('c') > -1 }]"
        points="80,82 60,92 60,138 80,158"
        fill="none"
        stroke="black"
      />
      <polygon
        :class="['digit', { active: activeList.indexOf('d') > -1 }]"
        points="2,160 78,160 58,140 22,140"
        fill="none"
        stroke="black"
      />
      <polygon
        :class="['digit', { active: activeList.indexOf('g') > -1 }]"
        points="2,80 22,70 58,70 78,80  58,90 22,90"
        fill="none"
        stroke="black"
      />
    </g>
  </svg>
</template>
 
<script>
export default {
  name: '',
  props: {
    num: {
      type: [Number, String],
      default: 0
    },
    color: {
      type: String,
      default: '#0ff'
    }
  },
  data() {
    return {
      digitPatterns: {
        0: ['a', 'b', 'c', 'd', 'e', 'f'],
        1: ['b', 'c'],
        2: ['a', 'b', 'd', 'e', 'g'],
        3: ['a', 'b', 'c', 'd', 'g'],
        4: ['b', 'c', 'f', 'g'],
        5: ['a', 'c', 'd', 'f', 'g'],
        6: ['a', 'c', 'd', 'e', 'f', 'g'],
        7: ['a', 'b', 'c'],
        8: ['a', 'b', 'c', 'd', 'e', 'f', 'g'],
        9: ['a', 'b', 'c', 'd', 'f', 'g']
      }
    };
  },
  computed: {
    activeList() {
      return this.digitPatterns[this.num];
    }
  },
  components: {},
  methods: {},
 
  mounted() {}
};
</script>
 
<style scoped>
.svg {
  width: 100%;
  height: 100%;
}
.digit {
  fill: rgba(0,0,0,.1);
  stroke: none;
  transition: fill 0.3s ease;
}
.digit.active {
  fill: var(--color);
  stroke: none;
}
</style>