contentDialog.vue 1.7 KB

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