PictureView


图片查看器,支持左右滑动切换。

依赖
Swiper
示例
  1. <div class="pic-box">
  2. <span v-for="(item, index) in picBox" @click="setPicShow(index)">
  3. <img :src="item">
  4. </span>
  5. </div>
  6. <nut-pictureview
  7. :visible.sync="picShow"
  8. :bgColor="coverColor"
  9. :imgArr="picBox"
  10. :initNum="picShowNum"
  11. :pagination="showPage"
  12. @close-pic="closeDo"
  13. ></nut-pictureview>

  1. export default {
  2. data(){
  3. return{
  4. picShow:false,
  5. picShowNum:1,
  6. showPage:true,
  7. coverColor:'rgba(0,0,0,.7)',
  8. picBox:['http://img10.360buyimg.com/n1/s368x368_jfs/t15451/283/338246331/345534/6b69d792/5a2a07c2N38f87e33.jpg',
  9. 'http://img10.360buyimg.com/n1/s368x368_jfs/t2590/194/2825053760/121163/21a0bec9/577335b9N8990670f.jpg',
  10. 'http://misc.360buyimg.com/mtd/pc/common/img/no_login.jpg'],
  11. }
  12. },
  13. methods:{
  14. setPicShow(index){
  15. this.picShowNum = index+1;
  16. this.picShow = true;
  17. },
  18. closeDo(){
  19. console.log('关闭了')
  20. }
  21. }
  22. }

Props
参数说明类型默认值可选值
visible初始状态显示或隐藏大图Booleanfalsetrue/false
bgColor设置黑色遮罩层透明度Stringrgba(0,0,0,.5)
imgArr大图数组Array[ ]
initNum显示大图时初始显示第几个Number1
pagination显示大图是是否显示点点点Booleanfalse
Events
事件名说明回调参数
close-pic点击关闭大图时触发