index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view v-if="modelValue" class="base-auth-dialog">
  3. <view class="base-auth-dialog__mask" @touchmove.stop.prevent />
  4. <view class="base-auth-dialog__panel">
  5. <view class="base-auth-dialog__title">
  6. {{ title }}
  7. </view>
  8. <view class="base-auth-dialog__content">
  9. <slot />
  10. </view>
  11. <button class="base-auth-dialog__confirm" @click="handleConfirm">
  12. {{ confirmText }}
  13. </button>
  14. </view>
  15. </view>
  16. </template>
  17. <script setup lang="ts">
  18. const modelValue = defineModel<boolean>({ default: false })
  19. withDefaults(
  20. defineProps<{
  21. title?: string
  22. confirmText?: string
  23. }>(),
  24. {
  25. title: '提示',
  26. confirmText: '确定',
  27. }
  28. )
  29. const emit = defineEmits<{
  30. confirm: []
  31. }>()
  32. const handleConfirm = () => {
  33. modelValue.value = false
  34. emit('confirm')
  35. }
  36. </script>
  37. <style lang="scss" scoped>
  38. .base-auth-dialog {
  39. position: fixed;
  40. inset: 0;
  41. z-index: 999;
  42. }
  43. .base-auth-dialog__mask {
  44. position: absolute;
  45. inset: 0;
  46. background: rgba(15, 23, 42, 0.48);
  47. }
  48. .base-auth-dialog__panel {
  49. position: absolute;
  50. top: 50%;
  51. left: 50%;
  52. width: 610rpx;
  53. overflow: hidden;
  54. border-radius: 28rpx;
  55. background: #ffffff;
  56. transform: translate(-50%, -50%);
  57. box-shadow: 0 28rpx 80rpx rgba(15, 23, 42, 0.18);
  58. }
  59. .base-auth-dialog__title {
  60. padding: 32rpx 36rpx 24rpx;
  61. color: #111827;
  62. font-size: 34rpx;
  63. font-weight: 700;
  64. line-height: 48rpx;
  65. text-align: center;
  66. }
  67. .base-auth-dialog__content {
  68. min-height: 300rpx;
  69. padding: 20rpx 36rpx 40rpx;
  70. box-sizing: border-box;
  71. color: #4b5563;
  72. font-size: 29rpx;
  73. line-height: 46rpx;
  74. }
  75. .base-auth-dialog__confirm {
  76. height: 92rpx;
  77. margin: 0;
  78. border-radius: 0;
  79. background: #1677ff;
  80. color: #ffffff;
  81. font-size: 32rpx;
  82. font-weight: 700;
  83. line-height: 92rpx;
  84. }
  85. .base-auth-dialog__confirm::after {
  86. border: none;
  87. }
  88. .base-auth-dialog__confirm:active {
  89. opacity: 0.9;
  90. }
  91. </style>