vue中实现图片全屏缩放预览,支持移动端

# 安装
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)

作者:小包子和蜗牛
链接:https://www.jianshu.com/p/68f108a7a450
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
# 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

猜你喜欢

转载自www.cnblogs.com/tanxiang6690/p/9881590.html