lookImgDialog.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!--照片浏览DIALOG-->
  2. <!--
  3. <lookImgDialog ref="lookImgDialog"></lookImgDialog>
  4. import lookImgDialog from '/@/components/lookImgDialog/lookImgDialog.vue'
  5. components: {
  6. lookImgDialog
  7. },
  8. /*
  9. 传入3个参数(1,list,index)
  10. 1-开启
  11. list-图片数据 [{url:"xxxxx"}]
  12. index-默认显示第几张图片
  13. */
  14. this.$refs.lookImgDialog.lookImgDialogOpen(1,list,index);
  15. -->
  16. <template>
  17. <el-dialog class="look-img-dialog" :title="lookImgDialogTitle" :visible.sync="lookImgDialogType" v-if="lookImgDialogType" width="1070px" height="700" append-to-body>
  18. <div class="look-img-dialog-min scrollbar-box">
  19. <img style="width:1026px;" :src="lookImgList[lookImgIndex].url">
  20. </div>
  21. <p class="el-icon-arrow-left left-i-button" @click="infoLeftButton"></p>
  22. <p class="el-icon-arrow-right right-i-button" @click="infoRightButton"></p>
  23. <p class="look-img-dialog-bottom-text">{{lookImgIndex+1}} / {{lookImgList.length}}</p>
  24. </el-dialog>
  25. </template>
  26. <script>
  27. export default {
  28. name: 'lookImgDialog',
  29. data(){
  30. return{
  31. lookImgDialogTitle:"",
  32. lookImgDialogType:false,
  33. lookImgList:[],
  34. lookImgIndex:null,
  35. }
  36. },
  37. created(){
  38. },
  39. mounted(){
  40. },
  41. methods:{
  42. lookImgDialogOpen(type,list,index,title){
  43. if(type == 1){
  44. this.$set(this,'lookImgList',list);
  45. this.$set(this,'lookImgIndex',index?index:0);
  46. this.$set(this,'lookImgDialogTitle',title?title:'照片');
  47. this.$set(this,'lookImgDialogType',true);
  48. }else if(type == 2){
  49. this.$set(this,'lookImgDialogType',false);
  50. }
  51. },
  52. infoLeftButton(){
  53. if (this.lookImgIndex == 0){
  54. this.msgError('当前是第一张')
  55. }else{
  56. this.lookImgIndex--
  57. }
  58. },
  59. infoRightButton(){
  60. if (this.lookImgIndex == this.lookImgList.length-1){
  61. this.msgError('当前是最后一张')
  62. }else{
  63. this.lookImgIndex++
  64. }
  65. },
  66. },
  67. }
  68. </script>
  69. <style scoped lang="scss">
  70. .look-img-dialog{
  71. .left-i-button{
  72. cursor: pointer;
  73. text-align: center;
  74. line-height:30px;
  75. color:#fff;
  76. font-size:16px;
  77. top:350px;
  78. left:40px;
  79. position: absolute;
  80. width:30px;
  81. height:30px;
  82. background-color: #0045AF;
  83. border-radius:50%;
  84. }
  85. .right-i-button{
  86. cursor: pointer;
  87. text-align: center;
  88. line-height:30px;
  89. color:#fff;
  90. font-size:16px;
  91. position: absolute;
  92. top:350px;
  93. right:40px;
  94. width:30px;
  95. height:30px;
  96. background-color: #0045AF;
  97. border-radius:50%;
  98. }
  99. .right-i-button:hover{
  100. background-color: #0183fa;
  101. }
  102. .left-i-button:hover{
  103. background-color: #0183fa;
  104. }
  105. .look-img-dialog-bottom-text{
  106. text-align: center;
  107. line-height: 30px;
  108. font-size:16px;
  109. position: absolute;
  110. bottom:0;
  111. width:1026px;
  112. }
  113. .look-img-dialog-min{
  114. height:560px;
  115. }
  116. }
  117. </style>