index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. },
  39. };
  40. </script>
  41. <template>
  42. <el-dialog
  43. :append-to-body="this.appendToBody"
  44. :modal-append-to-body="false"
  45. :visible.sync="visible"
  46. :top="top"
  47. :title="name"
  48. :width="width"
  49. v-bind="$attrs"
  50. v-on="$listeners"
  51. >
  52. <slot />
  53. </el-dialog>
  54. </template>
  55. <style scoped lang="less">
  56. ::v-deep(.el-dialog) {
  57. background: none;
  58. color: #fff;
  59. margin-bottom: 0px;
  60. .el-dialog__header {
  61. background-color: #012669ee;
  62. color: #fff;
  63. height: 60px;
  64. box-sizing: border-box;
  65. border-top: 2px solid #00aaff;
  66. .el-dialog__title {
  67. color: #fff;
  68. }
  69. .el-dialog__title::before {
  70. content: "";
  71. display: inline-block;
  72. background: url("../assets/modal_header.svg") no-repeat center center;
  73. width: 9px;
  74. height: 14px;
  75. margin-right: 10px;
  76. }
  77. .el-dialog__headerbtn .el-dialog__close {
  78. color: #fff;
  79. }
  80. }
  81. .el-dialog__header .el-dialog__headerbtn .el-dialog__close {
  82. background-color: rgba(255, 0, 0, .6);
  83. }
  84. .el-dialog__body {
  85. color: #fff;
  86. background-color: rgba(3, 18, 57, 0.9);
  87. }
  88. }
  89. </style>