You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
2.1 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <el-dialog :title="myTitle||title" append-to-body modal-append-to-body :visible.sync="visible" :fullscreen="fullscreen" :width="width?width:'70%'" :close-on-click-modal="closeOnClickModal">
  3. <slot :visible="visible" :title="myTitle||title" :data="this.data?this.data:{}" :dialog="that">
  4. </slot>
  5. <template slot="footer" >
  6. <slot name="footer" :visible="visible" :title="myTitle||title" :data="this.data?this.data:{}" :dialog="that" >
  7. </slot>
  8. </template>
  9. </el-dialog>
  10. </template>
  11. <script>
  12. export default {
  13. name: 'mdp-dialog',
  14. computed:{
  15. },
  16. watch:{
  17. },
  18. props:{
  19. /**
  20. * 弹出框的宽度
  21. */
  22. width:{
  23. type:String,
  24. default:'70%'
  25. },
  26. title:{
  27. type:String,
  28. default:'',
  29. },
  30. fullscreen:{
  31. type:Boolean,
  32. default:false
  33. },
  34. closeOnClickModal:{
  35. type:Boolean,
  36. default:false,
  37. }
  38. },
  39. data(){
  40. return {
  41. visible:false,
  42. data:{},
  43. that:this,
  44. myTitle:'请选择',
  45. }
  46. },
  47. methods:{
  48. open(data){
  49. this.visible=true
  50. this.data=data
  51. if(data && data.title){
  52. this.myTitle=data.title
  53. }else{
  54. this.myTitle=this.title
  55. }
  56. },
  57. close(){
  58. this.visible=false;
  59. }
  60. },
  61. mounted(){
  62. this.myTitle=this.title
  63. },
  64. updated(){
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .el-dialog {
  70. max-height: 96%;
  71. display: flex;
  72. flex-direction: column;
  73. margin: 0 !important;
  74. position: absolute;
  75. top: 50%;
  76. left: 50%;
  77. transform: translate(-50%, -50%);
  78. }
  79. .el-dialog .el-dialog__body {
  80. flex: 1;
  81. overflow: auto;
  82. }
  83. :root{
  84. --footer-height: 50px;
  85. }
  86. .footer{
  87. text-align: right;
  88. position: fixed;
  89. bottom: 0;
  90. margin-top:10px;
  91. width: 100%;
  92. right: 50px;
  93. line-height: var(--footer-height);
  94. color: #fff;
  95. }
  96. /**
  97. 修改弹出框关闭按钮放大原来的太小
  98. **/
  99. .el-dialog__headerbtn {
  100. top: 8px !important;
  101. background-size: cover;
  102. }
  103. .el-dialog__headerbtn i {
  104. font-size: 32px;
  105. }
  106. </style>