destroy-on-close.vue 916 B

123456789101112131415161718192021222324252627
  1. <template>
  2. <el-button text @click="centerDialogVisible = true">Click to open Dialog</el-button>
  3. <el-dialog v-model="centerDialogVisible" title="Notice" width="30%" destroy-on-close center>
  4. <span>Notice: before dialog gets opened for the first time this node and the one bellow will not be rendered</span>
  5. <div>
  6. <strong>Extra content (Not rendered)</strong>
  7. </div>
  8. <template #footer>
  9. <span class="dialog-footer">
  10. <el-button @click="centerDialogVisible = false">Cancel</el-button>
  11. <el-button type="primary" @click="centerDialogVisible = false">Confirm</el-button>
  12. </span>
  13. </template>
  14. </el-dialog>
  15. </template>
  16. <script lang="ts" setup>
  17. import { ref } from 'vue'
  18. const centerDialogVisible = ref(false)
  19. </script>
  20. <style scoped>
  21. .dialog-footer button:first-child {
  22. margin-right: 10px;
  23. }
  24. </style>