File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,19 @@ export function useFaDrawer() {
103103 // 挂载到当前实例
104104 instance ?. proxy ?. $el ?. appendChild ( container )
105105
106+ // 监听组件卸载,自动清理
107+ if ( instance ) {
108+ onUnmounted ( ( ) => {
109+ if ( vnode ) {
110+ render ( null , container )
111+ vnode = null
112+ }
113+ if ( container . parentNode ) {
114+ container . parentNode . removeChild ( container )
115+ }
116+ } )
117+ }
118+
106119 const open = ( ) => {
107120 visible . value = true
108121 }
Original file line number Diff line number Diff line change @@ -111,6 +111,19 @@ export function useFaModal() {
111111 // 挂载到当前实例
112112 instance ?. proxy ?. $el ?. appendChild ( container )
113113
114+ // 监听组件卸载,自动清理
115+ if ( instance ) {
116+ onUnmounted ( ( ) => {
117+ if ( vnode ) {
118+ render ( null , container )
119+ vnode = null
120+ }
121+ if ( container . parentNode ) {
122+ container . parentNode . removeChild ( container )
123+ }
124+ } )
125+ }
126+
114127 const open = ( ) => {
115128 visible . value = true
116129 }
You can’t perform that action at this time.
0 commit comments