index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <script>
  2. import { Dialog as ElDialog } from "element-ui";
  3. export default {
  4. name: "BasicModal",
  5. components: {
  6. ElDialog,
  7. },
  8. data() {
  9. return {
  10. visible: false,
  11. };
  12. },
  13. props: {
  14. top: {
  15. type: String,
  16. default: "184px",
  17. },
  18. width: {
  19. type: String,
  20. default: "1456px",
  21. },
  22. name: {
  23. type: String,
  24. default: "",
  25. },
  26. appendToBody: {
  27. type: Boolean,
  28. default: false,
  29. },
  30. },
  31. methods: {
  32. showModal() {
  33. this.visible = true;
  34. },
  35. closeModal() {
  36. this.visible = false;
  37. },
  38. slotTitle() {
  39. console.log(this.$slots)
  40. return "111"
  41. }
  42. },
  43. };
  44. </script>
  45. <template>
  46. <el-dialog
  47. :append-to-body="this.appendToBody"
  48. :modal-append-to-body="false"
  49. :visible.sync="visible"
  50. :top="top"
  51. :width="width"
  52. v-bind="$attrs"
  53. v-on="$listeners"
  54. :title="name"
  55. >
  56. <slot />
  57. <span slot="title" v-if="name===''" >
  58. <slot name="title" ></slot>
  59. </span>
  60. </el-dialog>
  61. </template>
  62. <style scoped lang="less">
  63. ::v-deep(.el-dialog) {
  64. background: none;
  65. color: #fff;
  66. margin-bottom: 0px;
  67. .el-dialog__header {
  68. background-color: #012669ee;
  69. color: #fff;
  70. height: 60px;
  71. box-sizing: border-box;
  72. border-top: 2px solid #00aaff;
  73. .el-dialog__title {
  74. color: #fff;
  75. }
  76. .el-dialog__title::before {
  77. content: "";
  78. display: inline-block;
  79. background: url("../assets/modal_header.svg") no-repeat center center;
  80. width: 9px;
  81. height: 14px;
  82. margin-right: 10px;
  83. }
  84. .el-dialog__headerbtn .el-dialog__close {
  85. color: #fff;
  86. }
  87. }
  88. .el-dialog__header .el-dialog__headerbtn .el-dialog__close {
  89. background-color: rgba(255, 0, 0, .4);
  90. padding: 4px;
  91. }
  92. .el-dialog__body {
  93. color: #fff;
  94. background-color: rgba(3, 18, 57, 0.9);
  95. }
  96. }
  97. </style>