customization-header.vue 948 B

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