Skip to content

Commit

Permalink
fix(element): fix protal destroy (#1898)
Browse files Browse the repository at this point in the history
  • Loading branch information
muuyao authored Jul 29, 2021
1 parent 52457e1 commit 1036440
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/element/src/__builtins__/shared/portal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineComponent, getCurrentInstance } from '@vue/composition-api'
import { defineComponent, onBeforeUnmount } from '@vue/composition-api'
import { h, Fragment } from '@formily/vue'
export interface IPortalProps {
id?: string | symbol
Expand All @@ -12,10 +12,19 @@ export const createPortalProvider = (id: string | symbol) => {
props: {
id: {
type: [String, Symbol],
default: 'form-dialog',
default: id,
},
},

setup(props) {
onBeforeUnmount(() => {
const { id } = props
if (id && PortalMap.has(id)) {
PortalMap.delete(id)
}
})
},

render() {
const { id } = this
if (id && !PortalMap.has(id)) {
Expand Down

0 comments on commit 1036440

Please sign in to comment.