imageViewer.vue 1.0 KB

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