mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[new feature] Dialog: add title slot (#3985)
This commit is contained in:
@@ -78,16 +78,17 @@ export default createComponent({
|
||||
return;
|
||||
}
|
||||
|
||||
const { title, message, messageAlign } = this;
|
||||
const children = this.slots();
|
||||
const { message, messageAlign } = this;
|
||||
const messageSlot = this.slots();
|
||||
const title = this.slots('title') || this.title;
|
||||
|
||||
const Title = title && (
|
||||
<div class={bem('header', { isolated: !message && !children })}>{title}</div>
|
||||
<div class={bem('header', { isolated: !message && !messageSlot })}>{title}</div>
|
||||
);
|
||||
|
||||
const Content = (children || message) && (
|
||||
const Content = (messageSlot || message) && (
|
||||
<div class={bem('content')}>
|
||||
{children || (
|
||||
{messageSlot || (
|
||||
<div
|
||||
domPropsInnerHTML={message}
|
||||
class={bem('message', { 'has-title': title, [messageAlign]: messageAlign })}
|
||||
@@ -131,7 +132,7 @@ export default createComponent({
|
||||
<div
|
||||
vShow={this.value}
|
||||
role="dialog"
|
||||
aria-labelledby={title || message}
|
||||
aria-labelledby={this.title || message}
|
||||
class={[bem(), this.className]}
|
||||
>
|
||||
{Title}
|
||||
|
Reference in New Issue
Block a user