Skip to content

Commit c95fca5

Browse files
baozjjbaozhangjietdesign-bot
authored
docs(alert): add a button to redisplay alert component when it is closed in usage demo (#5646)
* docs(alert): add '显示 Alert' button to alert usage demo when closable is enabled Enhance the alert usage demo by adding a "显示 Alert" button that only appears when the alert is closed. This improves the UX by allowing users to bring back the alert without refreshing the page. The change only affects the usage demo and does not modify the core component logic. * chore: stash changelog [ci skip] --------- Co-authored-by: baozhangjie <[email protected]> Co-authored-by: tdesign-bot <[email protected]>
1 parent a59f2de commit c95fca5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/components/alert/_usage/index.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
<!-- 该脚本为自动生成,如有需要请在 /script/generate-usage/index.js 中调整 -->
22
<template>
33
<base-usage :code="usageCode" :config-list="configList" :panel-list="panelList" @panel-change="onPanelChange">
4-
<template #alert="{ configProps }"><t-alert message="这是一条信息" v-bind="configProps" /></template>
4+
<template #alert="{ configProps }">
5+
<t-alert v-if="visible" message="这是一条信息" v-bind="configProps" @close="visible = false" />
6+
7+
<t-button v-if="!visible" size="small" theme="default" variant="outline" @click="showAlert">
8+
显示 Alert
9+
</t-button>
10+
</template>
511
</base-usage>
612
</template>
713

@@ -19,4 +25,9 @@ const usageCode = ref(`<template>${usageCodeMap[panelList[0].value].trim()}</tem
1925
function onPanelChange(panel) {
2026
usageCode.value = `<template>${usageCodeMap[panel].trim()}</template>`;
2127
}
28+
29+
const visible = ref(true);
30+
function showAlert() {
31+
visible.value = true;
32+
}
2233
</script>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
pr_number: 5646
3+
contributor: baozjj
4+
---
5+
6+
- docs(alert): 优化 Alert 演示交互,在关闭后显示“显示 Alert”按钮以恢复显示 @baozjj ([#5646](https://github.com/Tencent/tdesign-vue-next/pull/5646))

0 commit comments

Comments
 (0)