uni-PopupMessage.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class='uni-page'>
  3. <u-popup :show="modelshow" @close="close" :closeable="closeable" round="10rpx" :bgColor="bgColor" :mode="mode"
  4. :customStyle="{width:width}">
  5. <view class="dis f-c ">
  6. <!-- 头部自定义 -->
  7. <view class="header dis a-c j-c" :class="{borderBottom:border}" :style="headerStyle">
  8. <text>{{headerTitle}}</text>
  9. </view>
  10. <!-- 内容区插槽 -->
  11. <view class="content" :style="{overflow:overflow,maxHeight:maxHeight}">
  12. <slot name="content">
  13. </slot>
  14. </view>
  15. <!-- 弹窗底部统一样式 -->
  16. <view class="footer dis a-c j-s ">
  17. <view class="btn dis a-c j-c " @tap="cancelEvent">
  18. {{cancelText}}
  19. </view>
  20. <view class="btn dis a-c j-c " @tap="confirmEvent">
  21. {{confirmText}}
  22. </view>
  23. </view>
  24. </view>
  25. </u-popup>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. // 标签数据
  32. tabList: {
  33. type: Array,
  34. default: () => []
  35. },
  36. // 当前激活标签
  37. show: {
  38. type: Boolean,
  39. default: false
  40. },
  41. // 标题文字自定义
  42. headerTitle: {
  43. type: String,
  44. default: '提示',
  45. },
  46. // 取消按钮文字自定义
  47. cancelText: {
  48. type: String,
  49. default: '取消',
  50. },
  51. // 确认按钮文字自定义
  52. confirmText: {
  53. type: String,
  54. default: '确认',
  55. },
  56. bgColor: {
  57. type: String,
  58. default: '#FFF'
  59. },
  60. overflow: {
  61. type: String,
  62. default: '',
  63. },
  64. maxHeight: {
  65. type: String,
  66. default: ''
  67. },
  68. border: {
  69. type: Boolean,
  70. default: false,
  71. },
  72. headerStyle: Object,
  73. closeable: {
  74. type: Boolean,
  75. default: false,
  76. },
  77. //弹出方向
  78. mode: {
  79. type: String,
  80. default: 'center' //top / right / bottom / center
  81. },
  82. //弹窗宽度
  83. width: {
  84. type: String,
  85. default: '75%'
  86. }
  87. },
  88. data() {
  89. return {
  90. modelshow: this.show
  91. }
  92. },
  93. onShow() {
  94. },
  95. onLoad() {
  96. },
  97. watch: {
  98. show(newVal) {
  99. this.modelshow = newVal
  100. }
  101. },
  102. methods: {
  103. //弹窗关闭事件
  104. close() {
  105. this.$emit('close')
  106. },
  107. cancelEvent() {
  108. this.$emit('cancelEvent')
  109. },
  110. confirmEvent() {
  111. this.$emit('confirmEvent')
  112. },
  113. }
  114. }
  115. </script>
  116. <style lang='scss' scoped>
  117. .header {
  118. padding: 30rpx 40rpx 0;
  119. box-sizing: border-box;
  120. color: #333;
  121. font-size: 32rpx;
  122. font-weight: bold;
  123. }
  124. .borderBottom {
  125. border-bottom: 1px solid #EEEEEE;
  126. }
  127. .content {
  128. padding: 20rpx 40rpx 30rpx;
  129. box-sizing: border-box;
  130. color: #666;
  131. font-size: 30rpx;
  132. }
  133. .footer {
  134. border-top: 1rpx solid #EEEEEE;
  135. .btn {
  136. flex: 1;
  137. /* 等分宽度 */
  138. padding: 24rpx;
  139. font-size: 30rpx;
  140. color: #333;
  141. }
  142. :first-child {
  143. border-right: 1rpx solid #EEEEEE;
  144. color: #666;
  145. }
  146. :last-child {
  147. font-weight: bold;
  148. }
  149. }
  150. </style>