test.vue
6.61 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!--
* @Date: 2024-04-02 17:03:26
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-05-17 16:37:21
* @FilePath: /custom_dashboard/src/views/test.vue
* @Description: 文件描述
-->
<template>
<div style="">
<!--<svg width="500" height="500" viewBox="0 0 900 900">
<!~~ 定义裁剪路径 ~~>
<defs>
<clipPath id="clippath">
<!~~ 使用有效的路径来定义裁剪形状 ~~>
<path d="M0 0 L300 0 L300 110 A40 40 180 0 1 300 190 L300 300 L190 300 A40 40 180 0 0 110 300 L0 300 Z" />
</clipPath>
</defs>
<!~~ 应用遮罩和裁剪路径到图像 ~~>
<image width="900" height="900" :href="imageSrc" style="clip-path: url(#clippath); filter: grayscale(100%);" mask="url(#mask)" />
</svg>-->
<!--<div style="width: 100%; height: 100%;" class="boxer" >
<!~~ <div style="width: 100%; height: 100%;" > ~~>
<svg width="100%" height="100%" viewBox="0 0 100 100">
<!~~ 图像 ~~>
<!~~ <image style="width: 100%; height: 100%;" :href="imageSrc" /> ~~>
<!~~ 第一个格子的遮罩层 ~~>
<polygon points="0,0 20,0 20,20 0,20" fill="black" opacity="0.5" />
<!~~ 第二个格子的遮罩层 ~~>
<polygon points="10,10 30,10 30,30 10,30 10,20 20,20 20,10 10,10" fill="black" opacity="0.5" />
</svg>
</div>-->
<!-- <button @click="changeColor">改变颜色</button> -->
<!-- <div class="container-t"> -->
<!-- <div class="shape shape-t">
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Corrupti recusandae fugiat dicta ipsam ex non sunt maiores, nisi animi repellendus fugit facilis. Vitae pariatur cupiditate totam laboriosam optio! Qui, enim.
</div> -->
<!-- <div class="shape shape1"></div>
<div class="shape shape2"></div>
<div class="shape shape3"></div>
<div class="shape shape4"></div> -->
<!-- </div> -->
<!-- <div class="container">
<img src="https://cdn.ipadbiz.cn/tmp/fx_park/s1.png" class="img">
</div>
<div class="container">
<img src="https://cdn.ipadbiz.cn/tmp/fx_park/s2.png" class="img">
</div>
<div class="container">
<img src="https://cdn.ipadbiz.cn/tmp/fx_park/s3.png" class="img">
</div>
<div class="container">
<img src="https://cdn.ipadbiz.cn/tmp/fx_park/s4.png" class="img">
</div>
<div class="container">
<img src="https://cdn.ipadbiz.cn/tmp/fx_park/s5.png" class="img">
</div>
<div class="container">
<img src="https://cdn.ipadbiz.cn/tmp/fx_park/s6.png" class="img">
</div> -->
<geo-chart></geo-chart>
</div>
</template>
<script>
import mixin from 'common/mixin';
import GeoChart from '@/components/GeoChart.vue';
/*
如果希望 <polygon> 的位置和形状能够相对于图片保持不变,
可以考虑使用 viewBox 和 viewBox 中的坐标系来定义 <polygon> 的顶点坐标。
这样,无论图片大小如何改变,<polygon> 的位置和形状都会相对于图片保持不变。
使用 viewBox 和 viewBox 中的坐标系来定义 <polygon> 的顶点坐标:
*/
export default {
components: {
GeoChart
},
mixins: [mixin.init],
data () {
return {
imageSrc: 'https://picsum.photos/500/500',
svg_color: 'black',
}
},
mounted () {
},
methods: {
changeColor () {
this.svg_color = this.svg_color === 'black' ? 'white' : 'black';
}
}
}
</script>
<style lang="less" scoped>
.boxer {
background-image: url('https://picsum.photos/375/729');
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
.container-t {
width: 100%;
height: 100vh;
background-image: url('https://picsum.photos/375/729');
background-size: cover;
position: relative;
overflow: hidden; /* 确保超出容器部分被隐藏 */
}
.container {
width: 100%;
height: 100%;
background-size: contain;
position: absolute;
z-index: 1;
top: 0;
left: 0;
background-repeat: no-repeat;
}
.container1 {
width: 100%;
height: 100%;
background-size: contain;
position: absolute;
z-index: 1;
top: 0;
left: 0;
background-repeat: no-repeat;
}
.container2 {
width: 100%;
height: 100%;
background-size: contain;
position: absolute;
z-index: 10;
top: 0;
right: 0;
background-repeat: no-repeat;
}
.container3 {
width: 100%;
height: 100%;
// background-image: url('https://cdn.ipadbiz.cn/tmp/fx_park/s3.png');
background-size: contain;
position: absolute;
// overflow: hidden; /* 确保超出容器部分被隐藏 */
z-index: 10;
top: 0;
right: 0;
background-repeat: no-repeat;
}
.container4 {
width: 100%;
height: 100%;
// background-image: url('https://cdn.ipadbiz.cn/tmp/fx_park/s4.png');
background-size: contain;
position: absolute;
// overflow: hidden; /* 确保超出容器部分被隐藏 */
z-index: 10;
top: 0;
right: 0;
background-repeat: no-repeat;
}
.container5 {
width: 100%;
height: 100%;
// background-image: url('https://cdn.ipadbiz.cn/tmp/fx_park/s5.png');
background-size: contain;
position: absolute;
// overflow: hidden; /* 确保超出容器部分被隐藏 */
z-index: 10;
top: 0;
right: 0;
background-repeat: no-repeat;
background-position: left;
}
.container6 {
width: 100%;
height: 100%;
// background-image: url('https://cdn.ipadbiz.cn/tmp/fx_park/s6.png');
background-size: contain;
position: absolute;
// overflow: hidden; /* 确保超出容器部分被隐藏 */
z-index: 10;
bottom: 0;
right: 0;
background-repeat: no-repeat;
background-position: right;
}
.img {
position: absolute; top: 0; left: 0; width: 100%; object-fit: cover;
}
.mask {
mask: linear-gradient(to right, transparent, rgb(0, 0, 0));
}
.shape {
position: absolute;
}
.shape-t {
clip-path: polygon(52% 6.67%, 77.67% 10.67%, 90% 28.33%, 94% 54.67%, 86.33% 91%, 51.67% 94%, 22.67% 88.67%, 16.67% 64%, 13.33% 32.33%, 26% 11%);
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(119, 119, 119, 0.5);
border: 1px solid rgba(119, 119, 119, 0.5);
}
.shape1 {
clip-path: polygon(50% 0%, 74% 31%, 54% 82%, 33% 100%, 0 100%, 0% 60%, 0 0);
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(119, 119, 119, 0.5);
border: 1px solid rgba(119, 119, 119, 0.5);
}
.shape2 {
clip-path: polygon(50% 0%, 74% 31%, 54% 82%, 33% 100%, 100% 100%, 100% 54%, 100% 0);
width: 100%;
height: 100%;
top: 0;
right: 0;
background-color: rgba(20, 120, 119, 0.5);
}
</style>