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
| <template>
| <div class="science-box" ref="scienceBox" :style="getStyle">
| <div class="box-content">
| <div class="box-header" v-if="!noHeader">
| {{title}}
| </div>
| <div class="box-body">
| <slot></slot>
| </div>
| </div>
| </div>
| </template>
|
| <script>
| export default {
| props: {
| title: {
| type: String,
| default: ''
| },
| top: {
| type: Number,
| default: 0,
| },
| left: {
| type: Number,
| default: 0,
| },
| cssWidth: {
| type: [Number, String],
| default () {
| return 'auto';
| }
| },
| cssHeight: {
| type: [Number, String],
| default: 'auto'
| },
| bMax: {
| type: Number,
| default: 20000,
| },
| noHeader: {
| type: Boolean,
| default: false
| }
| },
| data() {
| return {
| height: 0,
| }
| },
| computed: {
| getStyle() {
| let bottom = this.top+this.height;
| let realTop = bottom>(this.bMax-8)?this.bMax-8-this.height
| :this.top;
| return {
| top: realTop+'px',
| left: this.left+'px',
| width: typeof this.cssWidth == 'number' ? this.cssWidth + 'px' : this.cssWidth,
| height: typeof this.cssHeight == 'number' ? this.cssHeight + 'px' : this.cssHeight
| }
| }
| },
| mounted() {
| this.height = this.$refs.scienceBox.offsetHeight;
| },
| }
| </script>
|
| <style scoped>
| .science-box {
| position: absolute;
| top: 0;
| left: 0;
| box-sizing: border-box;
| border: 2px solid #34ccee;
| border-image: linear-gradient(#12566d, #197796, #6decff, #197796, #12566d) 9;
| color: #FFFFFF;
| z-index: 9;
| }
| .box-content {
| height: 100%;
| padding-top: 6px;
| padding-bottom: 6px;
| padding-left: 12px;
| padding-right: 12px;
| background-image: linear-gradient(#164586, #143a6e, #0f2e5a, #07172e);
| box-sizing: border-box;
| }
| .box-header {
| font-size: 16px;
| text-align: center;
| font-weight: bold;
| padding-top: 6px;
| padding-bottom: 6px;
| }
| .box-body {
| min-width: 100px;
| min-height: 100px;
| }
| </style>
|
|