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
| <template>
| <foreignObject
| :transform="'translate(' + offset.join(',') + ')'"
| :width="width"
| :height="height"
| >
| <!-- foreignObject元素用于包裹非SVG元素 -->
| <div class="bg">
| <div class="border">
| <div class="title" v-if="title">
| {{ title }}
| </div>
| <div class="content">
| <slot></slot>
| </div>
| </div>
| </div>
| <!-- 这里放入了HTML标签 -->
| </foreignObject>
| </template>
|
| <script>
| export default {
| name: "",
| props: {
| offset: {
| type: Array,
| default() {
| return [0, 0];
| },
| },
| width: {
| type: [Number, String],
| default: 450,
| },
| height: {
| type: [Number, String],
| default: 306,
| },
| title: {
| type: String,
| default: "",
| },
| type: {
| type: String,
| default: "",
| },
| },
| data() {
| return {
| };
| },
| computed: {},
| methods: {
|
| },
|
| mounted() {
| },
| };
| </script>
|
| <style scoped>
| .bg {
| height: 100%;
| box-sizing: border-box;
| }
| .border {
| background: #017988;
| /* border: 1px #0ff solid; */
| border-radius: 6px;
| height: 100%;
| display: flex;
| flex-direction: column;
| overflow: hidden;
| }
| .title {
| background: #0ff;
| color: #000;
| font-size: 18px;
| font-weight: bold;
| height: 32px;
| line-height: 32px;
| text-align: center;
| position: relative;
| }
| .content {
| flex: 1;
| position: relative;
|
| }
| </style>
|
|