fix(components): [dialog/drawer] header slot

- Fix header slot rendering for both dialog and drawer.
- Change the deprecation for `title` slot to **3.0.0**.
This commit is contained in:
JeremyWuuuuu 2022-05-20 17:30:35 +08:00
parent e0a2544f70
commit c3486bcdce
2 changed files with 7 additions and 10 deletions

View File

@ -45,12 +45,13 @@
>
<template #header>
<slot
v-if="!$slots.title"
name="header"
:close="handleClose"
:title-id="titleId"
:title-class="ns.e('title')"
/>
<slot name="title" />
<slot v-else name="title" />
</template>
<slot />
<template v-if="$slots.footer" #footer>
@ -92,7 +93,7 @@ useDeprecated(
scope: 'el-dialog',
from: 'the title slot',
replacement: 'the header slot',
version: '2.3.0',
version: '3.0.0',
ref: 'https://element-plus.org/en-US/component/dialog.html#slots',
},
computed(() => !!slots.title)

View File

@ -41,21 +41,17 @@
/>
<header v-if="withHeader" :class="ns.e('header')">
<slot
v-if="!$slots.title"
name="header"
:close="handleClose"
:title-id="titleId"
:title-class="ns.e('title')"
>
<span
v-if="!$slots.title"
:id="titleId"
role="heading"
:class="ns.e('title')"
>
<span :id="titleId" role="heading" :class="ns.e('title')">
{{ title }}
</span>
</slot>
<slot name="title">
<slot v-else name="title">
<!-- DEPRECATED SLOT -->
</slot>
<button
@ -112,7 +108,7 @@ export default defineComponent({
scope: 'el-drawer',
from: 'the title slot',
replacement: 'the header slot',
version: '2.3.0',
version: '3.0.0',
ref: 'https://element-plus.org/en-US/component/drawer.html#slots',
},
computed(() => !!slots.title)