Popup.vue 1013 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view v-if="showPopup" class="popup-mask">
  3. <view class="popup-content">
  4. <view class="close-button" @click="closePopup">×</view>
  5. <slot></slot>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. showPopup: {
  13. type: Boolean,
  14. default: false
  15. }
  16. },
  17. methods: {
  18. closePopup() {
  19. this.$emit('close');
  20. }
  21. }
  22. };
  23. </script>
  24. <style>
  25. .popup-mask {
  26. position: fixed;
  27. top: 0;
  28. left: 0;
  29. width: 100%;
  30. height: 100%;
  31. background-color: rgba(0, 0, 0, 0.5);
  32. display: flex;
  33. justify-content: center;
  34. align-items: center;
  35. }
  36. .popup-content {
  37. /* Styling for the popup content */
  38. background-color: rgba(255, 255, 255, 0.9);
  39. width: 100%;
  40. height: 68%;
  41. padding: 30rpx;
  42. }
  43. .close-button {
  44. position: absolute;
  45. top: 60rpx;
  46. right: 30rpx;
  47. font-size: 38rpx;
  48. color: #fff;
  49. cursor: pointer;
  50. width: 46rpx;
  51. height: 46rpx;
  52. line-height: 46rpx;
  53. text-align: center;
  54. border-radius: 50%;
  55. background-color: rgba(255, 255, 255, 0.5);
  56. }
  57. </style>