From 929e1363ec1c95839493cf6621e31f4831bc6bd7 Mon Sep 17 00:00:00 2001
From: wuyiping0628 <42107997+wuyiping0628@users.noreply.github.com>
Date: Mon, 6 Jan 2025 18:10:26 -0800
Subject: [PATCH] feat(alert): [alert] display title when size is large (#2744)
* feat(alert): [alert] display title when size is large
* feat(alert): [alert] display title when size is large
---
examples/sites/demos/apis/alert.js | 14 ++++++++++++++
.../demos/pc/app/alert/title-composition-api.vue | 2 +-
examples/sites/demos/pc/app/alert/title.spec.ts | 3 +++
examples/sites/demos/pc/app/alert/title.vue | 2 +-
examples/sites/demos/pc/app/alert/webdoc/alert.js | 2 +-
packages/theme/src/alert/index.less | 2 ++
packages/vue/src/alert/src/index.ts | 4 ++++
packages/vue/src/alert/src/pc.vue | 7 +++----
8 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/examples/sites/demos/apis/alert.js b/examples/sites/demos/apis/alert.js
index bcc5f2d8e4..bbdd03f01b 100644
--- a/examples/sites/demos/apis/alert.js
+++ b/examples/sites/demos/apis/alert.js
@@ -118,6 +118,20 @@ export default {
pcDemo: 'show-icon',
mfDemo: ''
},
+ {
+ name: 'show-title',
+ type: 'boolean',
+ defaultValue: 'true',
+ desc: {
+ 'zh-CN': '是否显示标题,在 size 为 large 时有效',
+ 'en-US': 'Display title,valid when size is large'
+ },
+ mode: ['pc'],
+ pcDemo: 'title',
+ meta: {
+ stable: '3.21.0'
+ }
+ },
{
name: 'single-line',
type: 'String',
diff --git a/examples/sites/demos/pc/app/alert/title-composition-api.vue b/examples/sites/demos/pc/app/alert/title-composition-api.vue
index 785ff2af25..a83cac917e 100644
--- a/examples/sites/demos/pc/app/alert/title-composition-api.vue
+++ b/examples/sites/demos/pc/app/alert/title-composition-api.vue
@@ -6,7 +6,7 @@
通过 slot 设置自定义 title
-
diff --git a/examples/sites/demos/pc/app/alert/title.spec.ts b/examples/sites/demos/pc/app/alert/title.spec.ts
index d48e62b3b3..b9d0e469ee 100644
--- a/examples/sites/demos/pc/app/alert/title.spec.ts
+++ b/examples/sites/demos/pc/app/alert/title.spec.ts
@@ -9,4 +9,7 @@ test('测试 Alert 自定义标题', async ({ page }) => {
const title = alert.locator('.tiny-alert__title')
await expect(title).toHaveCount(1)
await expect(title).toHaveText('通过属性设置自定义 title')
+
+ const alert1 = page.locator('.tiny-alert--large').nth(2)
+ await expect(alert1).not.toHaveText('消息')
})
diff --git a/examples/sites/demos/pc/app/alert/title.vue b/examples/sites/demos/pc/app/alert/title.vue
index d0020861b5..f58c2beda4 100644
--- a/examples/sites/demos/pc/app/alert/title.vue
+++ b/examples/sites/demos/pc/app/alert/title.vue
@@ -6,7 +6,7 @@
通过 slot 设置自定义 title
-
diff --git a/examples/sites/demos/pc/app/alert/webdoc/alert.js b/examples/sites/demos/pc/app/alert/webdoc/alert.js
index f75eb57671..5cec406d51 100644
--- a/examples/sites/demos/pc/app/alert/webdoc/alert.js
+++ b/examples/sites/demos/pc/app/alert/webdoc/alert.js
@@ -53,7 +53,7 @@ export default {
'en-US': 'Custom Title'
},
desc: {
- 'zh-CN': `当 size
为 large
时,通过 title
属性或 title
插槽,可以自定义组件的标题。
+ 'zh-CN': `当 size
为 large
时,通过 title
属性或 title
插槽,可以自定义组件的标题 ,通过 show-title
属性 控制标题是否显示
如果未自定义标题,会根据对应的 type
显示相应的默认标题。`,
'en-US':
'
When size
is set to large, the title is displayed. You can set title
or slot
to customize the title.
The default title is displayed according to the set type
.