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
| <template>
| <g :transform="'translate(' + offset.join(',') + ')'">
| <!-- 圆角矩形 -->
| <path
| :d="createRoundRectPath(84, 30, 6)"
| stroke="none"
| fill="#F69F40"
| />
|
| <!-- 绘制标题 -->
| <text x="42" y="20" text-anchor="middle" fill="#011F39" font-size="18">
| 电操开关
| </text>
| </g>
| </template>
|
| <script>
| export default {
| name: "",
| props: {
| offset: {
| type: Array,
| default() {
| return [0, 0];
| },
| },
| },
| computed: {},
| data() {
| return {
| };
| },
| methods: {
| createRoundRectPath(w, h, r = 5, x = 0, y = 0) {
| let p0 = [x, y];
| let p1 = [x + w, y];
| let p2 = [x + w, y + h];
| let p3 = [x, y + h];
|
| let cp0 = [x + r, y];
| let cp1 = [x + w - r, y];
| let cp2 = [x + w, y + r];
| let cp3 = [x + w, y + h - r];
| let cp4 = [x + w - r, y + h];
| let cp5 = [x + r, y + h];
| let cp6 = [x, y + h - r];
| let cp7 = [x, y + r];
|
| return `M${cp0[0]},${cp0[1]}
| L ${cp1[0]} ${cp1[1]}
| C ${cp1[0]} ${cp1[1]}, ${p1[0]} ${p1[1]}, ${cp2[0]} ${cp2[1]}
| L ${cp3[0]} ${cp3[1]}
| C ${cp3[0]} ${cp3[1]}, ${p2[0]} ${p2[1]}, ${cp4[0]} ${cp4[1]}
| L ${cp5[0]} ${cp5[1]}
| C ${cp5[0]} ${cp5[1]}, ${p3[0]} ${p3[1]}, ${cp6[0]} ${cp6[1]}
| L ${cp7[0]} ${cp7[1]}
| C ${cp7[0]} ${cp7[1]}, ${p0[0]} ${p0[1]}, ${cp0[0]} ${cp0[1]}
| Z`;
| },
| },
|
| mounted() {},
| };
| </script>
|
| <style scoped>
| </style>
|
|