vue-preview縮略圖報錯解決
更新時間:2023年08月03日 11:51:12 作者:diuren1205
這篇文章主要為大家介紹了vue-preview縮略圖報錯解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
vue-preview
因為已經更新縮略圖,使用方法已經發(fā)生轉變,所以才會找不到$preview
控制臺錯誤信息
"$preview" is not defined on the instance but referenced during render
vue-preview(官網)
npm i vue-preview -S
main.js引用
import VuePreview from 'vue-preview' // defalut install Vue.use(VuePreview)
css樣式
.thumbs {
/deep/ .my-gallery{ //deep深層作用選擇器
display: flex;
flex-wrap:wrap;//默認換行
figure{
width: 30%;
margin: 5px;
img{
width: 100%;
box-shadow: 0 0 8px #999;
border-radius: 5px;
}
}
}Examples
<template>
<div class="thumbs">
<vue-preview :slides="slide1" @close="handleClose"></vue-preview>
</div>
</template>
<script>
export default {
data () {
return {
slide1: [
{
src: 'https://ss3.bdstatic.com/iPoZeXSm1A5BphGlnYG/skin/414.jpg?2',
msrc: 'https://ss3.bdstatic.com/iPoZeXSm1A5BphGlnYG/skin/414.jpg?2',
alt: 'picture1',
title: 'Image Caption 1',
w: 600,
h: 400
}
]
}
},
methods: {
handleClose () {
console.log('close event')
}
}
}
</script>實際展示

以上就是vue-preview縮略圖報錯解決的詳細內容,更多關于vue-preview縮略圖報錯的資料請關注腳本之家其它相關文章!
相關文章
jQuery中的replace字符串替換實現不同尺寸圖片切換功能
這篇文章主要介紹了jQuery之replace字符串替換實現不同尺寸圖片切換,使用jQuery的replace()方法可以很方便地實現不同尺寸圖片的切換,需要的朋友可以參考下2023-06-06

