Vue中使用v-view实现大图预览
中文文档
安装依赖包
npm install v-viewer
main.js中引入模块
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
// 配置viewer默认配置
Vue.use(Viewer, {
defaultOptions: {
zIndex: 9999
}
})
以组件形式使用
<el-table-column label='图片'
width='80px'
align='center'>
<template slot-scope="scope">
<viewer :images="[scope.row.picture.split(',')[0]]"
v-if="scope.row.picture">
<img v-for="(src,index) in [scope.row.picture.split(',')[0]]"
:src="src"
:key="index"
style="display:block;width:40px;height:40px;margin:0 auto;"
width="300">
</viewer>
<span v-else>暂无图片</span>
</template>
</el-table-column>
Vue大图预览组件v-view使用教程
本文介绍如何在Vue项目中使用v-view组件实现图片预览功能,包括安装依赖、配置默认选项及在表格中以组件形式展示图片预览的方法。
9247

被折叠的 条评论
为什么被折叠?



