lv-dialog.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="lv-dialog" v-if="show">
  3. <div class="lv-content">
  4. <div class="header">
  5. <div class="title">{{title ? title : '提示'}}</div>
  6. <div class="close" @click="close"></div>
  7. </div>
  8. </div>
  9. <div class="lv-bg"></div>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'lv-dialog',
  15. data () {
  16. return {
  17. show: false,
  18. }
  19. },
  20. watch: {
  21. value(newV) {
  22. this.show = newV;
  23. }
  24. },
  25. props: {
  26. value: {
  27. type: Boolean,
  28. default: false
  29. },
  30. title: String,
  31. },
  32. methods: {
  33. close() {
  34. this.$emit('input', false);
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="less" scope>
  40. .lv {
  41. &-dialog {
  42. position: fixed;
  43. z-index: 1000;
  44. top: 0;
  45. left: 0;
  46. width: 100%;
  47. height: 100%;
  48. }
  49. &-bg {
  50. position: absolute;
  51. top: 0;
  52. left: 0;
  53. width: 100%;
  54. height: 100%;
  55. background-color: rgba(0, 0, 0, .5);
  56. }
  57. &-content {
  58. user-select: none;
  59. position: absolute;
  60. z-index: 1000;
  61. top: 50%;
  62. left: 50%;
  63. width: 30%;
  64. min-width: 500px;
  65. min-height: 300px;
  66. background-color: #fff;
  67. transform: translate(-50%, -50%);
  68. .header {
  69. position: relative;
  70. height: 56px;
  71. line-height: 56px;
  72. border-bottom: solid 1px rgba(0, 0, 0, 0.06);
  73. .title {
  74. font-weight: bold;
  75. text-align: center;
  76. }
  77. .close {
  78. position: absolute;
  79. cursor: pointer;
  80. top: 18px;
  81. right: 20px;
  82. width: 20px;
  83. height: 20px;
  84. &::before, &::after {
  85. position: absolute;
  86. content: '';
  87. left: 10px;
  88. width: 1px;
  89. height: 20px;
  90. background-color: #666;
  91. }
  92. &::before {
  93. transform: rotate(45deg);
  94. }
  95. &::after {
  96. transform: rotate(-45deg);
  97. }
  98. }
  99. }
  100. }
  101. }
  102. </style>