message-popup.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view class="message-popup">
  3. <view class="mask" v-if="mask && visible"></view>
  4. <view class="content-popup">
  5. <uni-transition mode-class="fade" :show="visible">
  6. <view class="popup">
  7. <view class="title"> {{ title }}<slot name="title"></slot> </view>
  8. <view class="content">{{ content }} <slot name="content"></slot> </view>
  9. <text class="close iconfont icon-iconfontguanbi" @click="$emit('close')"></text>
  10. </view>
  11. </uni-transition>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'message-popup',
  18. props: {
  19. title: {
  20. type: String,
  21. default: ''
  22. },
  23. content: {
  24. type: String,
  25. default: ''
  26. },
  27. mask: {
  28. type: Boolean,
  29. default: true
  30. },
  31. visible: {
  32. type: Boolean,
  33. default: false
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. .message-popup {
  40. .mask {
  41. position: fixed;
  42. width: 100%;
  43. height: 100%;
  44. top: 0;
  45. left: 0;
  46. z-index: 9998;
  47. background: rgba(0, 0, 0, 0.6);
  48. }
  49. .content-popup{
  50. position: fixed;
  51. z-index: 9999;
  52. top: 50%;
  53. left: 50%;
  54. transform: translate(-50%,-70%);
  55. }
  56. .popup {
  57. width: 580rpx;
  58. // min-height: 540rpx;
  59. box-sizing: border-box;
  60. padding: 60rpx 26rpx;
  61. background: #fff;
  62. border-radius: 16rpx;
  63. .close {
  64. position: absolute;
  65. right: 24rpx;
  66. top: 24rpx;
  67. font-size: 32rpx;
  68. color: #d4dd4;
  69. }
  70. .title {
  71. text-align: center;
  72. font-size: 30rpx;
  73. color: #333333;
  74. margin-bottom: 54rpx;
  75. }
  76. .content {
  77. font-size: 26rpx;
  78. color: #666666;
  79. }
  80. }
  81. }
  82. </style>