nested-dialog.vue 837 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <el-button text @click="outerVisible = true">
  3. open the outer Dialog
  4. </el-button>
  5. <el-dialog v-model="outerVisible" title="Outer Dialog">
  6. <template #default>
  7. <el-dialog
  8. v-model="innerVisible"
  9. width="30%"
  10. title="Inner Dialog"
  11. append-to-body
  12. />
  13. </template>
  14. <template #footer>
  15. <div class="dialog-footer">
  16. <el-button @click="outerVisible = false">Cancel</el-button>
  17. <el-button type="primary" @click="innerVisible = true">
  18. open the inner Dialog
  19. </el-button>
  20. </div>
  21. </template>
  22. </el-dialog>
  23. </template>
  24. <script lang="ts" setup>
  25. import { ref } from 'vue'
  26. const outerVisible = ref(false)
  27. const innerVisible = ref(false)
  28. </script>
  29. <style scoped>
  30. .dialog-footer button:first-child {
  31. margin-right: 10px;
  32. }
  33. </style>