美文网首页
移动端Vue.js图片预览插件

移动端Vue.js图片预览插件

作者: 萧玄辞 | 来源:发表于2018-01-07 13:22 被阅读0次

vue-picture-preview

移动端Vue.js图片预览插件 | Mobile-friendly picture file preview Vue.js plugin with horizontal nav and bottom title.

安装

npm

npm install --save vue-picture-preview

使用

首先在项目的入口文件中引入, 调用 Vue.use 安装。

import vuePicturePreview from 'vue-picture-preview'

Vue.use(vuePicturePreview)

在根组件添加 lg-preview 组件的位置

<!-- Vue root compoment template -->

<div id="app">

    <router-view></router-view>

    <lg-preview></lg-preview>

</div>

对于所有图片都可以使用 v-preview 指令来绑定他们的预览功能

<img v-for="img in imgs" v-preview="img" :src="img">

export default {

    data () {

        return {

            imgs: ['http://covteam.u.qiniudn.com/ka2.jpg', 'http://covteam.u.qiniudn.com/poster.png']

        }

    }

}

API

isTitleEnable: (boolean, optional) 设置 isTitleEnable="false" 将禁用水平导航. 默认值: true.

isHorizontalNavEnable: (boolean, optional) 设置 isHorizontalNavEnable="false" 将禁用底部标题. 默认值: true.

相关文章

网友评论

      本文标题:移动端Vue.js图片预览插件

      本文链接:https://www.haomeiwen.com/subject/qyvpnxtx.html