mirror of https://github.com/ElemeFE/element
Alert: add support for title slot (#13082)
* Alert: add support for title slot * update documentspull/13145/head
parent
97728bddb5
commit
31d31d904d
|
@ -216,6 +216,11 @@ Description includes a message with more detailed information.
|
||||||
| close-text | customized close button text | string | — | — |
|
| close-text | customized close button text | string | — | — |
|
||||||
| show-icon | if a type icon is displayed | boolean | — | false |
|
| show-icon | if a type icon is displayed | boolean | — | false |
|
||||||
|
|
||||||
|
### Slot
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
|------|--------|
|
||||||
|
| title | content of the Alert title |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
| Event Name | Description | Parameters |
|
| Event Name | Description | Parameters |
|
||||||
|
|
|
@ -218,6 +218,11 @@ Descripción incluye un mensaje con información más detallada.
|
||||||
| close-text | texto de cerrado personalizado | string | — | — |
|
| close-text | texto de cerrado personalizado | string | — | — |
|
||||||
| show-icon | si un icono del tipo de alerta se debe mostrar | boolean | — | false |
|
| show-icon | si un icono del tipo de alerta se debe mostrar | boolean | — | false |
|
||||||
|
|
||||||
|
### Slot
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
|------|--------|
|
||||||
|
| title | El contenido del título de alerta. |
|
||||||
|
|
||||||
### Eventos
|
### Eventos
|
||||||
| Nombre del evento | Descripción | Parámetros |
|
| Nombre del evento | Descripción | Parámetros |
|
||||||
|
|
|
@ -210,6 +210,11 @@
|
||||||
| close-text | 关闭按钮自定义文本 | string | — | — |
|
| close-text | 关闭按钮自定义文本 | string | — | — |
|
||||||
| show-icon | 是否显示图标 | boolean | — | false |
|
| show-icon | 是否显示图标 | boolean | — | false |
|
||||||
|
|
||||||
|
### Slot
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
|------|--------|
|
||||||
|
| title | 标题的内容 |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
| 事件名称 | 说明 | 回调参数 |
|
| 事件名称 | 说明 | 回调参数 |
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
>
|
>
|
||||||
<i class="el-alert__icon" :class="[ iconClass, isBigIcon ]" v-if="showIcon"></i>
|
<i class="el-alert__icon" :class="[ iconClass, isBigIcon ]" v-if="showIcon"></i>
|
||||||
<div class="el-alert__content">
|
<div class="el-alert__content">
|
||||||
<span class="el-alert__title" :class="[ isBoldTitle ]" v-if="title">{{ title }}</span>
|
<span class="el-alert__title" :class="[ isBoldTitle ]" v-if="title || $slots.title">
|
||||||
|
<slot name="title">{{ title }}</slot>
|
||||||
|
</span>
|
||||||
<slot>
|
<slot>
|
||||||
<p class="el-alert__description" v-if="description">{{ description }}</p>
|
<p class="el-alert__description" v-if="description">{{ description }}</p>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
|
@ -35,6 +35,16 @@ describe('Alert', () => {
|
||||||
.to.equal('Unbowed, Unbent, Unbroken');
|
.to.equal('Unbowed, Unbent, Unbroken');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('title slot', () => {
|
||||||
|
vm = createVue(`
|
||||||
|
<el-alert>
|
||||||
|
<span slot="title">foo</span>
|
||||||
|
</el-alert>
|
||||||
|
`);
|
||||||
|
|
||||||
|
expect(vm.$el.querySelector('.el-alert__title').textContent).to.equal('foo');
|
||||||
|
});
|
||||||
|
|
||||||
it('close', () => {
|
it('close', () => {
|
||||||
vm = createVue({
|
vm = createVue({
|
||||||
template: `
|
template: `
|
||||||
|
|
Loading…
Reference in New Issue