imageViewer.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <script>
  2. export default {
  3. name: 'imageViewer',
  4. props: {
  5. src: {
  6. type: String,
  7. default: ''
  8. },
  9. alt: {
  10. type: String,
  11. default: ''
  12. }
  13. },
  14. data(){
  15. return {
  16. isFull: false,
  17. }
  18. },
  19. }
  20. </script>
  21. <template>
  22. <div class="img">
  23. <img :src="src" :alt="alt" />
  24. <div v-show="isFull" class="img-con">
  25. <div class="img-btn">+</div>
  26. <div class="img-btn">-</div>
  27. </div>
  28. </div>
  29. </template>
  30. <style scoped>
  31. .img{
  32. width: 100%;
  33. height: 100%;
  34. position: relative;
  35. display: flex;
  36. justify-content: center;
  37. align-items: center;
  38. background: #494949;
  39. transition: width 0.5s,height 0.5s;
  40. }
  41. .img img{
  42. display: block;
  43. height: 100%;
  44. width: auto;
  45. }
  46. .img .img-con{
  47. position: absolute;
  48. left: 0;
  49. bottom: 0;
  50. width: 100%;
  51. height: 45px;
  52. }
  53. .img .img-con .img-btn{
  54. display: inline-block;
  55. width: 45px;
  56. height: 45px;
  57. line-height: 45px;
  58. text-align: center;
  59. background-color: rgba(0,0,0,0.5);
  60. color: #fff;
  61. cursor: pointer;
  62. border-radius: 50%;
  63. }
  64. .img-full{
  65. position: fixed;
  66. left: 0;
  67. top: 0;
  68. width: 100%;
  69. height: 100%;
  70. z-index: 999;
  71. }
  72. </style>