mypopup.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="popup" v-show="show">
  3. <view class="popup-info">
  4. <view class="popup-title"> {{titleText}}</view>
  5. <view class="popup-text">{{popupText}}</view>
  6. <view class="popup-btn">
  7. <view class="btn-left" @click="cancel">{{cancelText}}</view>
  8. <view class="btn-right" @click="confirm">{{confirmText}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. name: "my-popup",
  16. props: {
  17. show: {
  18. type: Boolean
  19. },
  20. popupText: {
  21. type: String
  22. },
  23. titleText: {
  24. type: String
  25. },
  26. cancelText: {
  27. type: String
  28. },
  29. confirmText: {
  30. type: String
  31. }
  32. },
  33. watch: {
  34. oldshow: function(newVal, oldVal) {
  35. // console.log(newVal);
  36. this.show = newVal;
  37. console.log(newVal)
  38. }
  39. },
  40. data() {
  41. return {};
  42. },
  43. methods: {
  44. cancel() {
  45. this.$emit('close')
  46. },
  47. confirm() {
  48. this.$emit('confirm')
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .popup {
  55. position: fixed;
  56. left: 0;
  57. right: 0;
  58. top: 0;
  59. height: 100vh;
  60. background-color: rgba(0, 0, 0, 0.4) !important;
  61. z-index: 9998;
  62. }
  63. .popup-info {
  64. position: fixed;
  65. width: 320px;
  66. top: 50%;
  67. left: 50%;
  68. transform: translate(-50%, -50%);
  69. font-size: 30upx;
  70. box-shadow: 0px 1px 13px -6px rgba(0, 0, 0, 0.25);
  71. background-color: #fff;
  72. z-index: 9999;
  73. border-radius: 8px;
  74. display: flex;
  75. flex-direction: column;
  76. align-items: center;
  77. .popup-title {
  78. width: 320px;
  79. height: 56px;
  80. background: linear-gradient(95.13deg, #5DA4F7 3.75%, #3285E4 95.95%);
  81. border-radius: 8px 8px 0px 0px;
  82. display: flex;
  83. justify-content: center;
  84. align-items: center;
  85. font-family: 'PingFang SC';
  86. font-style: normal;
  87. font-weight: 500;
  88. font-size: 17px;
  89. line-height: 24px;
  90. /* identical to box height, or 140% */
  91. color: #FFFFFF;
  92. }
  93. .popup-text {
  94. width: 262px;
  95. display: flex;
  96. justify-content: center;
  97. margin-top: 23px;
  98. text-align: center;
  99. font-family: 'PingFang SC';
  100. font-style: normal;
  101. font-weight: 500;
  102. font-size: 17px;
  103. line-height: 24px;
  104. }
  105. .popup-btn {
  106. display: flex;
  107. flex-direction: row;
  108. justify-content: space-between;
  109. width: 250px;
  110. height: 42px;
  111. border-top-color: #f5f5f5;
  112. margin: 0 auto;
  113. margin-top: 22px;
  114. margin-bottom: 20px;
  115. .btn-left {
  116. /* #ifndef APP-NVUE */
  117. display: flex;
  118. /* #endif */
  119. width: 107px;
  120. height: 42px;
  121. border: 0.5px solid #569FF4;
  122. border-radius: 35px;
  123. justify-content: center;
  124. align-items: center;
  125. font-family: 'PingFang SC';
  126. font-style: normal;
  127. font-weight: 500;
  128. font-size: 16px;
  129. line-height: 22px;
  130. letter-spacing: -0.2176px;
  131. color: #569FF4;
  132. }
  133. .btn-right {
  134. display: flex;
  135. align-items: center;
  136. width: 107px;
  137. height: 42px;
  138. background: linear-gradient(95.13deg, #5DA4F7 3.75%, #3285E4 95.95%);
  139. border-radius: 35px;
  140. justify-content: center;
  141. align-items: center;
  142. font-color: #FFFFFF;
  143. font-family: 'PingFang SC';
  144. font-style: normal;
  145. font-weight: 500;
  146. font-size: 16px;
  147. line-height: 22px;
  148. letter-spacing: -0.2176px;
  149. color: #FFFFFF;
  150. }
  151. }
  152. }
  153. </style>