fix(notification): 限制全局消息最大显示数量为1

修复通知组件在多次触发时可能显示多条消息的问题,通过配置 message prop 的 maxCount 参数确保始终只显示最新的一条通知消息
This commit is contained in:
dap
2026-02-03 15:51:21 +08:00
parent d7552b0faf
commit 70acbdd7c5
2 changed files with 14 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ const otherProps = computed<
:wave="waveConfig"
v-bind="otherProps"
>
<App>
<App :message="{ maxCount: 1 }">
<RouterView />
<PopupContext />
</App>

View File

@@ -76,6 +76,10 @@ function handleClick() {
}
const loading = ref(true);
function keepOneMessage() {
window.message.success('只有一条消息');
}
</script>
<template>
@@ -84,7 +88,15 @@ const loading = ref(true);
<template #message>
该分支使用antdv-next替代不维护的ant-design-vue
<a-button class="ml-2" size="small" type="primary" @click="handleClick">
疯狂点击
新的 notification 样式
</a-button>
<a-button
class="ml-2"
size="small"
type="primary"
@click="keepOneMessage"
>
保持一条消息
</a-button>
</template>
</Alert>