You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
1.9 KiB

4 years ago
  1. <template>
  2. <uni-popup ref="popup">
  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 row b-t">
  9. <view class="btn center" @click="close">
  10. <text>{{ cancelText }}</text>
  11. </view>
  12. <view class="btn center b-l" @click="confirm">
  13. <text>{{ confirmText }}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </uni-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. };
  32. },
  33. props: {
  34. title: String,
  35. text: String,
  36. cancelText: {
  37. type: String,
  38. default: '取消'
  39. },
  40. confirmText: {
  41. type: String,
  42. default: '确定'
  43. }
  44. },
  45. methods: {
  46. confirm(){
  47. this.$emit('onConfirm');
  48. this.close();
  49. },
  50. open(){
  51. this.$refs.popup.open();
  52. },
  53. close(){
  54. this.$refs.popup.close();
  55. }
  56. }
  57. }
  58. </script>
  59. <style scoped lang='scss'>
  60. .pop-content{
  61. display: flex;
  62. flex-direction: column;
  63. align-items: center;
  64. justify-content: center;
  65. width: 540rpx;
  66. padding-top: 36rpx;
  67. background-color: #fff;
  68. border-radius: 24rpx;
  69. overflow: hidden;
  70. .title{
  71. font-size: 32rpx;
  72. color: #333;
  73. line-height: 48rpx;
  74. font-weight: 700;
  75. }
  76. .con{
  77. padding: 36rpx 40rpx 54rpx;
  78. }
  79. .text{
  80. width: 460rpx;
  81. font-size: 26rpx;
  82. color: #333;
  83. line-height: 40rpx;
  84. text-align: center;
  85. }
  86. .btn-group{
  87. width: 100%;
  88. }
  89. .btn{
  90. flex: 1;
  91. height: 88rpx;
  92. line-height: 88rpx;
  93. font-size: 32rpx;
  94. color: #777;
  95. &:last-child{
  96. color: #007aff;
  97. }
  98. }
  99. }
  100. </style>