index.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div class="pop-modal">
  3. <ele-modal
  4. width="400px"
  5. :title="title"
  6. :visible.sync="visible"
  7. custom-class="ele-dialog-form"
  8. :close-on-click-modal="true"
  9. @update:visible="updateVisible"
  10. >
  11. <div style="padding: 10px 0 20px;">{{content}}</div>
  12. <template v-slot:footer>
  13. <el-button @click="updateVisible(false)">取消</el-button>
  14. <el-button type="primary" :loading="loading" @click="handleCommit">
  15. 提交
  16. </el-button>
  17. </template>
  18. </ele-modal>
  19. </div>
  20. </template>
  21. <script>
  22. export default {
  23. data(){
  24. return {
  25. loading:false
  26. }
  27. },
  28. props: {
  29. title: {
  30. typeof: String,
  31. default: '温馨提示'
  32. },
  33. content:{
  34. typeof: String,
  35. default: ''
  36. },
  37. visible: {
  38. typeof: Boolean,
  39. default: false
  40. }
  41. },
  42. methods:{
  43. /* 更新visible */
  44. updateVisible(value) {
  45. this.$emit('update:visible', value);
  46. },
  47. handleCommit(){
  48. this.loading = true;
  49. this.$emit('done');
  50. setTimeout(() => {
  51. this.updateVisible(false);
  52. this.loading = false;
  53. }, 800);
  54. }
  55. }
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. ::v-deep .ele-dialog-form {
  60. .el-dialog__header{
  61. border-bottom: 0;
  62. }
  63. .el-dialog__footer{
  64. border-top: 0;
  65. }
  66. }
  67. </style>