qiepingDl.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <uni-popup ref="commonPopup" :animation="false" :is-mask-click="false"
  3. mask-background-color="rgba(0, 0, 0, 0.4)">
  4. <view class="phone-common-dialog">
  5. <view class="common-body-box">
  6. <view class="common-title">{{title}}</view>
  7. <view class="common-content" :class="dialogContentClass">{{content}}</view>
  8. <view class="common-btn-box">
  9. <view class="confirm-btn" @click="confirmBtn">{{okBtn}}</view>
  10. </view>
  11. </view>
  12. </view>
  13. </uni-popup>
  14. </template>
  15. <script setup>
  16. import { ref } from 'vue';
  17. const props = defineProps({
  18. title: {
  19. type: String,
  20. default: ''
  21. },
  22. content: {
  23. type: String,
  24. require: true,
  25. default: ''
  26. },
  27. dialogContentClass: {
  28. type: String,
  29. require: true,
  30. default: 'content-center-class'
  31. },
  32. notBtn: {
  33. type: String,
  34. require: true,
  35. default: '取消'
  36. },
  37. okBtn: {
  38. type: String,
  39. require: true,
  40. default: '确认'
  41. },
  42. });
  43. const commonPopup = ref(null); // 索引
  44. const $emit = defineEmits(['confirm-btn'])
  45. // 打开弹窗
  46. function handleShow() {
  47. commonPopup.value.open();
  48. }
  49. // 取消
  50. function handleClose() {
  51. commonPopup.value.close();
  52. }
  53. // 确认
  54. function confirmBtn(){
  55. $emit('confirm-btn');
  56. commonPopup.value.close();
  57. }
  58. defineExpose({
  59. handleShow,
  60. handleClose
  61. })
  62. </script>
  63. <style>
  64. </style>