dialogConfirm.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!--
  2. * @FileDescription: 提示确认类型弹窗
  3. * @Author: 黄琪勇
  4. * @Date:2024-03-20 19:18:13
  5. -->
  6. <template>
  7. <div class="dialogConfirm">
  8. <div class="close" @click="close"></div>
  9. <img class="headImg" v-if="props.modalData.headImg" :src="props.modalData.headImg" />
  10. <div class="textCon">
  11. <div class="text">{{ props.modalData.text }}</div>
  12. </div>
  13. <div v-if="filterBtnShow" class="dialogBtn">
  14. <img v-if="props.modalData.btnShow[1]" @click="cancel" src="@/img/useDialogConfirm/cancel.png" />
  15. <img v-if="props.modalData.btnShow[0]" @click="ok" src="@/img/useDialogConfirm/ok.png" />
  16. </div>
  17. </div>
  18. </template>
  19. <script setup lang="ts">
  20. import { computed } from "vue"
  21. const props = defineProps<{
  22. modalData: {
  23. text: string
  24. btnShow: [boolean?, boolean?]
  25. headImg?: string
  26. }
  27. }>()
  28. const emits = defineEmits<{
  29. (e: "onClose"): void
  30. (e: "onCancel"): void
  31. (e: "onOk"): void
  32. }>()
  33. const filterBtnShow = computed(() => {
  34. const { btnShow } = props.modalData
  35. return !!(btnShow[0] || btnShow[1])
  36. })
  37. function close() {
  38. emits("onClose")
  39. }
  40. function cancel() {
  41. emits("onCancel")
  42. }
  43. function ok() {
  44. emits("onOk")
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .dialogConfirm {
  49. padding-top: 36px;
  50. padding-bottom: 22px;
  51. width: 100%;
  52. height: 100%;
  53. display: flex;
  54. flex-direction: column;
  55. .close {
  56. position: absolute;
  57. top: -14px;
  58. right: -16px;
  59. width: 42px;
  60. height: 44px;
  61. cursor: pointer;
  62. background: url("@/img/useDialogConfirm/close.png") no-repeat;
  63. &:hover {
  64. background: url("@/img/useDialogConfirm/closeHover.png") no-repeat;
  65. background-size: cover;
  66. }
  67. }
  68. .headImg {
  69. position: absolute;
  70. left: 50%;
  71. top: -13px;
  72. transform: translate(-50%, 0);
  73. }
  74. .textCon {
  75. flex-grow: 1;
  76. display: flex;
  77. align-items: center;
  78. justify-content: center;
  79. padding: 0 20px;
  80. overflow: hidden;
  81. .text {
  82. font-size: 20px;
  83. color: #a04d11;
  84. line-height: 32px;
  85. }
  86. }
  87. .dialogBtn {
  88. flex-shrink: 0;
  89. display: flex;
  90. justify-content: center;
  91. margin-top: 6px;
  92. > img {
  93. cursor: pointer;
  94. margin-left: 12px;
  95. &:hover {
  96. opacity: $opacity-hover;
  97. }
  98. }
  99. }
  100. }
  101. </style>