index.vue 860 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <transition name="msgbox-fade">
  3. <div class="preview-mask pub-scroll-box" v-if="visible">
  4. <i class="el-icon-close" @click="visible = false"></i>
  5. <img class="img" :src="imgUrl" alt="">
  6. </div>
  7. </transition>
  8. </template>
  9. <script>
  10. export default {
  11. name: 'imgPreview'
  12. }
  13. </script>
  14. <style lang="scss" scoped>
  15. .preview-mask{
  16. position: fixed;
  17. left: 0;
  18. right: 0;
  19. top: 0;
  20. bottom: 0;
  21. z-index: 999;
  22. background-color: rgba($color: #000000, $alpha: .8);
  23. text-align: center;
  24. overflow: auto;
  25. &::after{
  26. content: '';
  27. display: inline-block;
  28. height: 100%;
  29. vertical-align: middle;
  30. }
  31. }
  32. .img{
  33. max-width: 100%;
  34. max-height: 100%;
  35. vertical-align: middle;
  36. }
  37. .el-icon-close{
  38. position: absolute;
  39. right: 6px;
  40. top: 6px;
  41. font-size: 30px;
  42. cursor: pointer;
  43. z-index: 1000;
  44. color: #ffffff;
  45. }
  46. </style>