customization-header.vue 753 B

123456789101112131415161718192021
  1. <template>
  2. <el-button @click="visible = true"> Open Drawer with customized header </el-button>
  3. <el-drawer v-model="visible" :show-close="false">
  4. <template #header="{ close, titleId, titleClass }">
  5. <h4 :id="titleId" :class="titleClass">This is a custom header!</h4>
  6. <el-button type="danger" @click="close">
  7. <el-icon class="el-icon--left"><CircleCloseFilled /></el-icon>
  8. Close
  9. </el-button>
  10. </template>
  11. This is drawer content.
  12. </el-drawer>
  13. </template>
  14. <script lang="ts" setup>
  15. import { ref } from 'vue'
  16. import { ElButton, ElDrawer } from 'element-plus'
  17. import { CircleCloseFilled } from '@element-plus/icons-vue'
  18. const visible = ref(false)
  19. </script>