如果我們在 vue 中想使用縮略圖的話,可以使用 vue-preview 的插件
小圖的縮略
大圖的樣式
使用方法:vue-preview
下 載: npm i vue-preview
使用方法: 在 src 目錄中的 main.js 中使用
import VuePreview from 'vue-preview'
Vue
在需要縮略圖的組件中,使用
template 中 寫入
<div>
<vue-preview :slides="list" @close="handleClose"></vue-preview>
</div>
備注:list 就是我們的圖片的循環
在 script 中使用 的 exprot default {} 中的 data 中使用的 list 的數據格式
.my-gallery:after{
content:"";
display:block;
visibility: hidden;
clear:both;
height:0
}
.my-gallery figure{
width:100px;
height:100px;
float:left;
margin:.100px;
padding:0;
box-shadow:0 0 .100px #ccc;
}