style-dialog.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="style-dialog" @click.stop>
  3. <view :style="{ background }">
  4. <view class="style-dialog_head flex-center">
  5. <view class="ok" @click.stop="close">
  6. <text type="success" v-if="confirm" @click.stop="handleConfirm">确定</text>
  7. </view>
  8. <view class="fw-500 color-000 fs-32">{{ title }}</view>
  9. <view class="close" @click.stop="close">
  10. <uni-icons type="closeempty" size="24" color="#2D284B"></uni-icons>
  11. </view>
  12. </view>
  13. <view class="style-dialog_body">
  14. <slot></slot>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script lang="ts">
  20. export default {
  21. props: {
  22. title: String,
  23. background: {
  24. type: String,
  25. default: "#fff",
  26. },
  27. confirm:{
  28. type:Boolean,
  29. default:false
  30. }
  31. },
  32. methods: {
  33. close() {
  34. this.$emit("close");
  35. },
  36. handleConfirm(){
  37. this.$emit('ok');
  38. }
  39. },
  40. };
  41. </script>
  42. <style lang="scss">
  43. .style-dialog {
  44. position: fixed;
  45. width: 100%;
  46. height: 100%;
  47. left: 0;
  48. bottom: 0;
  49. right: 0;
  50. top: 0;
  51. z-index: 999;
  52. background-color: rgba(0, 0, 0, 0.6);
  53. display: flex;
  54. align-items: flex-end;
  55. & > view {
  56. width: 100%;
  57. overflow: hidden;
  58. border-radius: 20rpx 20rpx 0px 0px;
  59. box-sizing: content-box;
  60. }
  61. &_head {
  62. height: 92rpx;
  63. position: relative;
  64. background-color: #fff;
  65. .close {
  66. position: absolute;
  67. right: 30rpx;
  68. top: 50%;
  69. transform: translateY(-50%);
  70. }
  71. .ok {
  72. position: absolute;
  73. left: 30rpx;
  74. top: 50%;
  75. transform: translateY(-50%);
  76. color: var(--color-primary);
  77. }
  78. }
  79. &_body {
  80. max-height: 1000rpx;
  81. overflow-y: auto;
  82. }
  83. }
  84. </style>