destroy-on-close.vue 923 B

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