Vue 中使用Viewer.js与 修改展示Viewer.js中图片title
npm下载npm install viewerjs引入import { mapGetters } from 'vuex';import Viewer from 'viewerjs';使用this.updateUserName = this.arrimg[this.carouselIndex].createUserName;this.updateTime =...
·
npm下载
npm install viewerjs
引入
import { mapGetters } from 'vuex';
import Viewer from 'viewerjs';
使用
参考
https://www.dowebok.com/demo/192/index3.html
this.updateUserName = this.arrimg[this.carouselIndex].createUserName;
this.updateTime = this.arrimg[this.carouselIndex].createTime;
const _that = this;
const zgviewer = new Viewer(document.getElementById('idviewers'), {
hidden: function () {
zgviewer.destroy();
},
zIndex: 3000,
toolbar: {
zoomIn: 1,
zoomOut: 1,
oneToOne: 1,
reset: 1,
prev: {
show: true,
size: 'small',
click: () => {
if (this.carouselIndex === 0) {
this.carouselIndex = this.arrimg.length - 1;
} else {
this.carouselIndex -= 1;
}
this.updateInfo();
zgviewer.prev(true);
}
},
play: 0,
next: {
show: true,
size: 'small',
click: () => {
if (this.carouselIndex === 0) {
this.carouselIndex = this.arrimg.length - 1;
} else {
this.carouselIndex -= 1;
}
this.updateInfo();
zgviewer.next(true);
}
},
rotateLeft: 1,
rotateRight: 1,
flipHorizontal: 1,
flipVertical: 1
},
// 自定义title
title: function() {
const viewdiv = '上传人: ' + _that.updateUserName + '上传时间: ' + _that.updateTime;
return viewdiv;
}
});
更多推荐
已为社区贡献2条内容
所有评论(0)