Skip to content

Commit f617f42

Browse files
authored
feat(alert): [alert] display title when size is large in mobile-first (#2765)
* feat(alert): [alert] display title when size is large * feat(alert): [alert] display title when size is large * feat(alert): [alert] display title when size is large in mobile-first
1 parent 2e45a76 commit f617f42

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

examples/sites/demos/apis/alert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default {
126126
'zh-CN': '是否显示标题,在 size 为 large 时有效',
127127
'en-US': 'Display title,valid when size is large'
128128
},
129-
mode: ['pc'],
129+
mode: ['pc', 'mobile-first'],
130130
pcDemo: 'title',
131131
meta: {
132132
stable: '3.21.0'

examples/sites/demos/mobile-first/app/alert/title.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<tiny-alert size="large">
66
<template #title>通过 slot 设置自定义 title</template>
77
</tiny-alert>
8+
<br />
9+
<tiny-alert size="large" :show-title="false" description="描写内容"></tiny-alert>
810
</div>
911
</template>
1012

examples/sites/demos/mobile-first/app/alert/webdoc/alert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default {
3636
},
3737
desc: {
3838
'zh-CN':
39-
'<p>当 <code>size</code>为 large 时显示标题,可设置 <code>title</code> 或 <code>slot</code> 自定义标题。默认标题根据设置的 <code>type</code> 显示。</p>',
39+
'<p>当 <code>size</code>为 large 时显示标题,可设置 <code>title</code> 或 <code>slot</code> 自定义标题,通过 <code> show-title </code>属性控制标题是否显示。默认标题根据设置的 <code>type</code> 显示。</p>',
4040
'en-US':
4141
'<p>When <code>size</code> is set to large, the title is displayed. You can set <code>title</code> or <code>slot</code> to customize the title. The default title is displayed according to the set <code>type</code>.</p>'
4242
},

examples/sites/demos/pc/app/alert/webdoc/alert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default {
5353
'en-US': 'Custom Title'
5454
},
5555
desc: {
56-
'zh-CN': `当 <code>size</code> 为 <code>large</code> 时,通过 <code>title </code>属性或 <code>title </code>插槽,可以自定义组件的标题 ,通过 <code> show-title </code>属性 控制标题是否显示<br>
56+
'zh-CN': `当 <code>size</code> 为 <code>large</code> 时,通过 <code>title </code>属性或 <code>title </code>插槽,可以自定义组件的标题 ,通过 <code> show-title </code>属性控制标题是否显示<br>
5757
如果未自定义标题,会根据对应的 <code>type</code> 显示相应的默认标题。`,
5858
'en-US':
5959
'<p>When <code>size</code> is set to large, the title is displayed. You can set <code>title</code> or <code>slot</code> to customize the title. <br>The default title is displayed according to the set <code>type</code> . </p>'

packages/vue/src/alert/src/mobile-first.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
>
3535
<div
3636
data-tag="tiny-alert-large"
37-
v-if="size === 'large'"
37+
v-if="size === 'large' && showTitle"
3838
@click="handleHeaderClick"
3939
class="inline-flex cursor-pointer font-medium"
4040
>
@@ -94,8 +94,8 @@
9494
class="flex-1 leading-6 text-sm overflow-hidden cursor-pointer"
9595
:class="[showIcon ? 'ml-2' : '', closable ? 'mr-2' : '']"
9696
>
97-
<div data-tag="tiny-alert-large" v-if="size === 'large'" class="font-medium">
98-
<slot name="title">{{ state.getTitle }}</slot>
97+
<div data-tag="tiny-alert-large" v-if="size === 'large' && showTitle" class="font-medium">
98+
<slot name="title">{{ state.getTitle }} </slot>
9999
</div>
100100
<div
101101
data-tag="tiny-alert-singlelinebox"
@@ -152,6 +152,7 @@ export default defineComponent({
152152
'closable',
153153
'center',
154154
'showIcon',
155+
'showTitle',
155156
'closeText',
156157
'singleLine',
157158
'scrolling',

0 commit comments

Comments
 (0)