y-modal.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <u-popup ref="popup" mode="center" :show= "show" border-radius='16'>
  3. <view class="pop-content">
  4. <text class="title">{{ title }}</text>
  5. <view class="con center">
  6. <text class="text">{{ text }}</text>
  7. </view>
  8. <view class="btn-group dfsb ">
  9. <view class="btn center" @click="close">
  10. <text>{{ cancelText }}</text>
  11. </view>
  12. <view class="btn center " @click="confirm">
  13. <text class="txt">{{ confirmText }}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </u-popup>
  18. </template>
  19. <script>
  20. /**
  21. * 确认对话框
  22. * @prop title 标题
  23. * @prop text 提示内容
  24. * @prop cancelText 取消按钮文字
  25. * @prop confirmText 确认按钮文字
  26. * @event onConfirm 确认按钮点击时触发
  27. */
  28. export default {
  29. data() {
  30. return {
  31. show:false,
  32. };
  33. },
  34. props: {
  35. title: String,
  36. text: String,
  37. cancelText: {
  38. type: String,
  39. default: '取消'
  40. },
  41. confirmText: {
  42. type: String,
  43. default: '确定'
  44. }
  45. },
  46. methods: {
  47. confirm() {
  48. this.$emit('onConfirm');
  49. this.close();
  50. },
  51. open() {
  52. this.show=true;
  53. },
  54. close() {
  55. this.show=false;
  56. }
  57. }
  58. };
  59. </script>
  60. <style scoped lang="scss">
  61. .pop-content {
  62. display: flex;
  63. flex-direction: column;
  64. align-items: center;
  65. justify-content: center;
  66. width: 616rpx;
  67. padding-top: 36rpx;
  68. background-color: #fff;
  69. overflow: hidden;
  70. margin: 0 auto;
  71. .title {
  72. font-size: 32rpx;
  73. color: #333;
  74. line-height: 48rpx;
  75. font-weight: 700;
  76. }
  77. .con {
  78. padding: 36rpx 40rpx 54rpx;
  79. }
  80. .text {
  81. width: 460rpx;
  82. font-size: 26rpx;
  83. color: #333;
  84. line-height: 40rpx;
  85. text-align: center;
  86. }
  87. .btn-group {
  88. width: 100%;
  89. }
  90. .center {
  91. text-align: center;
  92. }
  93. .btn {
  94. flex: 1;
  95. height: 88rpx;
  96. line-height: 88rpx;
  97. font-size: 32rpx;
  98. color: #333;
  99. background: #f6f6f6;
  100. &:last-of-type {
  101. background-color: $promain;
  102. .txt {
  103. color: #ffffff;
  104. }
  105. }
  106. }
  107. }
  108. </style>