vue 组件预览图片

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

2018.01.07 13:22:17字数 194阅读 5749

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.

5人点赞

日记本

发布了293 篇原创文章 · 获赞 27 · 访问量 12万+

猜你喜欢

转载自blog.csdn.net/gwdgwd123/article/details/102612378