1
0

index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. .el-dialog__header {
  60. background-color: rgba(0, 102, 255, 0.26);
  61. color: #fff;
  62. height: 60px;
  63. box-sizing: border-box;
  64. border-top: 2px solid #00aaff;
  65. .el-dialog__title {
  66. color: #fff;
  67. }
  68. .el-dialog__title::before {
  69. content: "";
  70. display: inline-block;
  71. background: url("../assets/modal_header.svg") no-repeat center center;
  72. width: 9px;
  73. height: 14px;
  74. margin-right: 10px;
  75. }
  76. .el-dialog__headerbtn .el-dialog__close {
  77. color: #fff;
  78. }
  79. }
  80. .el-dialog__body {
  81. color: #fff;
  82. background-color: rgba(3, 18, 57, 0.78);
  83. }
  84. }
  85. </style>