可以参考elementUI 源码:import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
let index = 0 // 初始索引,也可以组件传过来
let list = [1, 2, 3]
prev() { // 上
const len = this.list.length;
this.index = (this.index - 1 + len) % len;
},
next() { // 下
const len = this.list.length;
this.index = (this.index + 1) % len;
},
06-08