fix(components): [tag] leave animations not working (#18006)

* fix(components): [tag] leave animations not working

* use @vue:mounted to ensure forward compatibility with Vue

Co-authored-by: btea <2356281422@qq.com>

---------

Co-authored-by: btea <2356281422@qq.com>
This commit is contained in:
dopamine 2024-08-28 22:18:23 +08:00 committed by GitHub
parent e48eec1c58
commit be23e0ccb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,7 +12,12 @@
<Close />
</el-icon>
</span>
<transition v-else :name="`${ns.namespace.value}-zoom-in-center`" appear>
<transition
v-else
:name="`${ns.namespace.value}-zoom-in-center`"
appear
@vue:mounted="handleVNodeMounted"
>
<span
:class="containerKls"
:style="{ backgroundColor: color }"
@ -36,6 +41,7 @@ import { useNamespace } from '@element-plus/hooks'
import { useFormSize } from '@element-plus/components/form'
import { tagEmits, tagProps } from './tag'
import type { VNode } from 'vue'
defineOptions({
name: 'ElTag',
@ -66,4 +72,9 @@ const handleClose = (event: MouseEvent) => {
const handleClick = (event: MouseEvent) => {
emit('click', event)
}
const handleVNodeMounted = (vnode: VNode) => {
// @ts-ignore
vnode.component.subTree.component.bum = null
}
</script>