# 安装
npm install vue-photo-preview --save

 

# 引入
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
Vue.use(preview)
//或者 
//var option={....} option配置请查看 http://photoswipe.com/documentation/options.html
//Vue.use(preview,option)

 

# umd
<link rel="stylesheet" type="text/css" href="路径/dist/skin.css"/>

<script src="路径/dist/vue-photo-preview.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    var options={
        fullscreenEl:false //关闭全屏按钮
    }
    
    Vue.use(vuePhotoPreview,options)
    
    new Vue({
        el:'#app'
    })
</script>

 

# html
//在img标签添加preview属性 preview值相同即表示为同一组
<img防止转换 src="xxx.jpg" preview preview-text="描述文字">

//分组
<img防止转换 src="xxx.jpg" preview="1" preview-text="描述文字">
<img防止转换 src="xxx.jpg" preview="1" preview-text="描述文字">

<img防止转换 src="xxx.jpg" preview="2" preview-text="描述文字">
<img防止转换 src="xxx.jpg" preview="2" preview-text="描述文字">

 

插件配置文档

 

在线演示 

 

Github

相关文章:

  • 2023-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-17
  • 2021-12-30
  • 2022-02-07
  • 2021-12-22
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案