picLarge.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /**
  2. *@author:Guoxiaohuan
  3. *@date:2020.05.28
  4. *@info:大图预览
  5. */
  6. <template>
  7. <div class='tpyl'>
  8. <el-dialog title='图片预览' class='tpyl-1' width='90%' :visible.sync='dialogVisible' :close-on-click-modal='false' append-to-body>
  9. <div class='pic-list'>
  10. <div class='pic-left'>
  11. <ul v-for='(item,index) in imgUrl' :key='index'>
  12. <li @click='getIndex(item.url)'>
  13. <img :src='item.url' />
  14. </li>
  15. <!-- <span>{{item.name}}</span> -->
  16. </ul>
  17. </div>
  18. <div class='pic-right'>
  19. <div class='pic-right-img'>
  20. <img :src='ImgUrl' />
  21. </div>
  22. </div>
  23. </div>
  24. </el-dialog>
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. name: 'PicLarge',
  30. props: ['imgUrl'],
  31. data() {
  32. return {
  33. dialogVisible: false,
  34. ImgUrl: ''
  35. }
  36. },
  37. methods: {
  38. open() {
  39. this.dialogVisible = true
  40. },
  41. getIndex(imgUrl) {
  42. this.ImgUrl = imgUrl
  43. }
  44. },
  45. computed: {
  46. __imgUrl() {
  47. return this.imgUrl
  48. }
  49. },
  50. watch: {
  51. __imgUrl: {
  52. handler(newV, oldV) {
  53. newV.length && (this.ImgUrl = this.imgUrl[0].url)
  54. },
  55. deep: true
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="less" scoped>
  61. .pic-list {
  62. width: 100%;
  63. // height: 700px;
  64. display: flex;
  65. justify-content: space-between;
  66. .pic-left {
  67. width: 230px;
  68. background: #ffffff;
  69. overflow: auto;
  70. margin-top: 20px;
  71. margin-bottom: 20px;
  72. ul {
  73. margin-bottom: 0;
  74. width: 180px;
  75. margin: 0 auto;
  76. li {
  77. width: 180px;
  78. height: 135px;
  79. border-radius: 4px;
  80. border: 4px solid rgba(245, 246, 247, 1);
  81. img {
  82. max-width: 100%;
  83. max-height: 100%;
  84. display: block;
  85. margin: auto;
  86. border-radius: 4px;
  87. }
  88. }
  89. span {
  90. height: 16px;
  91. font-size: 12px;
  92. font-family: MicrosoftYaHei;
  93. color: rgba(31, 36, 41, 1);
  94. line-height: 16px;
  95. display: flex;
  96. justify-content: center;
  97. margin-top: 12px;
  98. margin-bottom: 20px;
  99. }
  100. }
  101. }
  102. .pic-right {
  103. flex: 1;
  104. background: rgba(245, 246, 247, 1);
  105. border-radius: 0px 0px 4px 0px;
  106. padding: 60px 50px;
  107. margin: auto auto;
  108. display: flex;
  109. justify-content: center;
  110. align-items: center;
  111. .pic-right-img {
  112. width: 720px;
  113. height: 540px;
  114. text-align: center;
  115. img {
  116. max-width: 100%;
  117. max-height: 100%;
  118. display: block;
  119. margin: auto;
  120. }
  121. }
  122. }
  123. }
  124. </style>
  125. <style lang="less">
  126. .tpyl-1 {
  127. overflow: hidden;
  128. .el-dialog {
  129. height: 90vh !important;
  130. margin-top: 5vh !important;
  131. .el-dialog__body {
  132. padding: 10px;
  133. }
  134. }
  135. }
  136. </style>