PopUp.vue 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div v-if="show" class="overlay" @click="onClose">
  3. <div class="warp" @click.stop>
  4. <img :src="info.image" class="image" alt="" />
  5. <div class="text" @scroll.passive="() => {}">
  6. {{ info.content }}
  7. </div>
  8. </div>
  9. </div>
  10. </template>
  11. <script setup>
  12. const props = defineProps({
  13. show: Boolean,
  14. info: Object,
  15. onClose: {
  16. type: Function,
  17. default: () => {},
  18. },
  19. });
  20. </script>
  21. <style lang="less" scoped>
  22. .overlay {
  23. position: fixed;
  24. top: 0;
  25. left: 0;
  26. width: 100vw;
  27. height: 100vh;
  28. z-index: 100;
  29. overflow: hidden;
  30. background: rgba(0, 0, 0, 0.5);
  31. display: flex;
  32. flex-direction: column;
  33. justify-content: center;
  34. align-items: center;
  35. .warp {
  36. margin: 0 auto;
  37. width: 80%;
  38. height: 80%;
  39. overflow: hidden;
  40. display: flex;
  41. flex-direction: column;
  42. // background: fff;
  43. .image {
  44. width: 100%;
  45. }
  46. .text {
  47. line-height: 1.6em;
  48. padding: 0 20px;
  49. font-size: 20px;
  50. text-indent: 42px;
  51. margin-top: 50px;
  52. color: #fff;
  53. overflow-y: auto;
  54. }
  55. .text::-webkit-scrollbar {
  56. display: none;
  57. }
  58. }
  59. animation: fade-in; /*动画名称*/
  60. animation-duration: 0.7s; /*动画持续时间*/
  61. }
  62. @keyframes fade-in {
  63. 0% {
  64. opacity: 0;
  65. } /*初始状态 透明度为0*/
  66. // 40% {
  67. // opacity: 0.3;
  68. // } /*过渡状态 透明度为0*/
  69. 100% {
  70. opacity: 1;
  71. } /*结束状态 透明度为1*/
  72. }
  73. </style>