centered-content.vue 788 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <el-button text @click="centerDialogVisible = true">
  3. Click to open the Dialog
  4. </el-button>
  5. <el-dialog v-model="centerDialogVisible" title="Warning" width="30%" center>
  6. <span>
  7. It should be noted that the content will not be aligned in center by
  8. default
  9. </span>
  10. <template #footer>
  11. <span class="dialog-footer">
  12. <el-button @click="centerDialogVisible = false">Cancel</el-button>
  13. <el-button type="primary" @click="centerDialogVisible = false">
  14. Confirm
  15. </el-button>
  16. </span>
  17. </template>
  18. </el-dialog>
  19. </template>
  20. <script lang="ts" setup>
  21. import { ref } from 'vue'
  22. const centerDialogVisible = ref(false)
  23. </script>
  24. <style scoped>
  25. .dialog-footer button:first-child {
  26. margin-right: 10px;
  27. }
  28. </style>