index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div class="simple-dialog" v-if="value">
  3. <div class="simple-dialog__container">
  4. <span
  5. class="el-icon-close simple-dialog__colse"
  6. @click="onCloseClick"
  7. ></span>
  8. <div class="simple-dialog__title">
  9. <span class="simple-dialog__title__text">提示</span>
  10. <slot name="title"></slot>
  11. </div>
  12. <div class="simple-dialog__content">
  13. <slot></slot>
  14. <span class="simple-dialog__content__text">这是内容</span>
  15. </div>
  16. <div class="simple-dialog__footer">
  17. <slot name="footer"></slot>
  18. <div
  19. class="simple-dialog__confirm"
  20. v-if="!$slots.footer"
  21. @click="onClick"
  22. >
  23. 确定
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. export default {
  31. model: {
  32. prop: 'value',
  33. event: 'change',
  34. },
  35. props: {
  36. value: {
  37. type: Boolean,
  38. default: false,
  39. },
  40. },
  41. methods: {
  42. onCloseClick() {
  43. this.$emit('change', false)
  44. },
  45. onClick() {
  46. this.$emit('click')
  47. },
  48. },
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .simple-dialog {
  53. display: flex;
  54. justify-content: center;
  55. align-items: center;
  56. width: 100%;
  57. height: 100vh;
  58. position: fixed;
  59. top: 0;
  60. left: 0;
  61. background: rgba(0, 0, 0, 0.39);
  62. .simple-dialog__container {
  63. position: relative;
  64. width: 76vw;
  65. min-height: 20vw;
  66. background: #fff;
  67. .simple-dialog__colse {
  68. width: 6.4vw;
  69. height: 6.4vw;
  70. font-size: 5vw;
  71. position: absolute;
  72. top: 3vw;
  73. right: 3vw;
  74. text-align: center;
  75. line-height: 6.4vw;
  76. color: #c2c2c2;
  77. }
  78. .simple-dialog__title {
  79. padding: 3vw 4.8vw;
  80. border-bottom: 1px solid #c2c2c2;
  81. .simple-dialog__title__text {
  82. font-size: 4.2vw;
  83. color: #282828;
  84. }
  85. }
  86. .simple-dialog__content {
  87. padding: 3vw 4.8vw;
  88. .simple-dialog__content__text {
  89. font-size: 3.6vw;
  90. color: #282828;
  91. }
  92. }
  93. .simple-dialog__footer {
  94. padding: 0 4.8vw 7vw;
  95. .simple-dialog__confirm {
  96. width: 100%;
  97. height: 8.8vw;
  98. text-align: center;
  99. background: #f3920d;
  100. color: #fff;
  101. line-height: 8.8vw;
  102. font-size: 3.6vw;
  103. }
  104. }
  105. }
  106. }
  107. </style>