Commit 0262b484 authored by 赵啸非's avatar 赵啸非

修改导航

parent dbb1fd1b
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="gallery-box" v-if=" photos.length > 0"> <div class="gallery-box" v-if=" photos.length > 0">
<div class="gallery"> <div class="gallery">
<div class="active-photo" :style="'background-image: url('+ photos[activePhoto]+');'"> <div class="active-photo" :style="'background-image: url('+ photos[activePhoto]+');'">
<button type="button" <!-- <button type="button"
aria-label="Previous Photo" aria-label="Previous Photo"
class="previous" class="previous"
@click="previousPhoto()"> @click="previousPhoto()">
...@@ -14,19 +14,26 @@ ...@@ -14,19 +14,26 @@
class="next" class="next"
@click="nextPhoto()"> @click="nextPhoto()">
</button> </button>-->
</div> </div>
<div class="thumbnails"> <div class="thumbnails" >
<div v-for="(photo, index) in photos" <div v-for="(photo, index) in photos"
:key="index" :key="index"
:src="photo" :src="photo"
@click="activePhoto = index" @click="activePhoto = index"
:class="{'active': activePhoto === index}" :class="{'active': activePhoto === index}"
:style="'background-image: url('+photo+');background-size: cover; /* 让背景填充整个区域 */\n'+ :style="'background-image: url('+photo+');'">
' background-position: center center; /* 保持居中 */\n'+
' background-repeat: no-repeat;'">
</div> </div>
</div>
<!--
<div class="image-container">
<img v-for="(photo, index) in photos" :src="photo" />
<div/>
-->
</div>
</div> </div>
</div> </div>
...@@ -136,12 +143,12 @@ export default { ...@@ -136,12 +143,12 @@ export default {
.gallery-box .gallery .active-photo { .gallery-box .gallery .active-photo {
width: 100%; width: 100%;
margin-bottom: 5px; margin-bottom: 5px;
padding-bottom: 65%; padding-bottom: 60%;
background-size: cover;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: contain;
border: 2px solid #fff; border: 2px solid #fff;
position: relative;
} }
.gallery-box .gallery .active-photo button { .gallery-box .gallery .active-photo button {
...@@ -180,6 +187,7 @@ export default { ...@@ -180,6 +187,7 @@ export default {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
grid-gap: 4px; grid-gap: 4px;
} }
.thumbnails div { .thumbnails div {
border: 2px solid #fff; border: 2px solid #fff;
...@@ -190,6 +198,7 @@ export default { ...@@ -190,6 +198,7 @@ export default {
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
opacity: 1; opacity: 1;
place-items: center;
} }
.thumbnails:hover { .thumbnails:hover {
/*opacity: 0.6;*/ /*opacity: 0.6;*/
...@@ -200,4 +209,16 @@ export default { ...@@ -200,4 +209,16 @@ export default {
} }
.image-container {
width: 300px; /* 设定固定宽度 */
height: 200px; /* 设定固定高度 */
overflow: hidden; /* 防止溢出 */
}
.image-container img {
width: 100%;
height: auto;
clip-path: inset(10% 10% 10% 10%);
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment