-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix(message): restore API compatibility and thenable chaining semantics #8504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
bbc85e7
52c0bdb
4cea6f3
8fb26a2
43873b1
ebcb73f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| <template> | ||
| <div :class="itemClasses" :style="item.args.style"> | ||
| <div :class="itemClasses" :style="item.args.style" @click="handleClick"> | ||
| <div class="ant-message-notice-content"> | ||
| <span v-if="iconNode" class="ant-message-icon"> | ||
| <component :is="iconNode" /> | ||
|
|
@@ -14,7 +14,7 @@ | |
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { computed, onMounted, onBeforeUnmount, isVNode, type Component } from 'vue' | ||
| import { computed, onMounted, onBeforeUnmount, watch, isVNode, type Component } from 'vue' | ||
| import { | ||
| InfoCircleFilled, | ||
| CheckCircleFilled, | ||
|
|
@@ -75,10 +75,22 @@ function clearTimer() { | |
| } | ||
| } | ||
|
|
||
| function handleClick(event: MouseEvent) { | ||
| props.item.args.onClick?.(event) | ||
| } | ||
|
|
||
| onMounted(() => { | ||
| startTimer() | ||
| }) | ||
|
|
||
| watch( | ||
| () => props.item.args, | ||
| () => { | ||
| clearTimer() | ||
| startTimer() | ||
| }, | ||
| ) | ||
|
Comment on lines
+86
to
+92
|
||
|
|
||
| onBeforeUnmount(() => { | ||
| clearTimer() | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onClickis now forwarded viahandleClick, but there isn't a regression test covering that a click on the rendered message calls the provided callback. Adding a small test foronClickwould help prevent this behavior from breaking later.