Skip to content

Commit

Permalink
Merge branch 'formily_next' of github.com:alibaba/formily into formil…
Browse files Browse the repository at this point in the history
…y_next
  • Loading branch information
janryWang committed Jul 30, 2021
2 parents d9b088e + 1036440 commit 94890cb
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 94890cb

Please sign in to comment.