fix(components): fix message closeAll (#3583)

This commit is contained in:
三咲智子 2021-09-23 14:18:53 +08:00 committed by GitHub
parent d8954f945e
commit 34745432d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,12 @@ import isServer from '@element-plus/utils/isServer'
import MessageConstructor from './message.vue' import MessageConstructor from './message.vue'
import { messageTypes } from './message' import { messageTypes } from './message'
import type { MessagePartial, MessageQueue, MessageProps } from './message' import type {
MessagePartial,
Message,
MessageQueue,
MessageProps,
} from './message'
import type { ComponentPublicInstance, VNode } from 'vue' import type { ComponentPublicInstance, VNode } from 'vue'
const instances: MessageQueue = [] const instances: MessageQueue = []
@ -110,11 +115,11 @@ export function close(id: string, userOnClose?: (vm: VNode) => void): void {
export function closeAll(): void { export function closeAll(): void {
for (let i = instances.length - 1; i >= 0; i--) { for (let i = instances.length - 1; i >= 0; i--) {
const instance = instances[i].vm.component as any const instance = instances[i].vm.component
instance.ctx.close() ;(instance?.proxy as any)?.close()
} }
} }
message.closeAll = closeAll message.closeAll = closeAll
export default message export default message as Message