he wei
2025-05-08 84ff051d5c6bbf10e71f6f8d1d57740c26619d9e
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
<script >
export default {
  props: {
    offset: {
      type: Array,
      default: () => [0, 0],
    },
    points: {
      type: Array,
      default: () => [
        [0, 0],
        [10, 10],
      ],
    },
    name: {
      type: String,
      default: '',
    },
    color: {
      type: String,
      default: "#804000",
    },
    lineWidth: {
      type: Number,
      default: 4,
    },
    currColor: {
      type: String,
      default: "#0f0",
    },
 
  },
  computed: {
    path() {
 
      let points = this.points;
      let path = `M ${points[0].join(",")} `;
      for (let i = 1, len = points.length; i < len; i++) {
        path += ` L ${points[i].join(",")} `;
      }
      return path;
    }
  },
}
 
</script>
 
<template>
  <g ref="g" :transform="'translate(' + offset.join(',') + ')'">
    <path :d="path" ref="path" fill="none" :stroke-width="lineWidth" :stroke="color"></path>
    <text :x="points[1][0] + 10" :y="points[1][1]+10"
        font-family="Verdana"
        fill="#fff"
        
        font-size="8">
      {{ name }}
    </text>
  </g>
</template>
 
<style scoped lang="less"></style>