customization-header.vue 874 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <el-button @click="visible = true">
  3. Open Dialog with customized header
  4. </el-button>
  5. <el-dialog v-model="visible" :show-close="false">
  6. <template #header="{ close, titleId, titleClass }">
  7. <div class="my-header">
  8. <h4 :id="titleId" :class="titleClass">This is a custom header!</h4>
  9. <el-button type="danger" @click="close">
  10. <el-icon class="el-icon--left"><CircleCloseFilled /></el-icon>
  11. Close
  12. </el-button>
  13. </div>
  14. </template>
  15. This is dialog content.
  16. </el-dialog>
  17. </template>
  18. <script lang="ts" setup>
  19. import { ref } from 'vue'
  20. import { ElButton, ElDialog } from 'element-plus'
  21. import { CircleCloseFilled } from '@element-plus/icons-vue'
  22. const visible = ref(false)
  23. </script>
  24. <style scoped>
  25. .my-header {
  26. display: flex;
  27. flex-direction: row;
  28. justify-content: space-between;
  29. }
  30. </style>