@@ -51,7 +51,7 @@ export default mixins(classPrefixMixins, getAttachConfigMixins('popup')).extend(
5151 /** popperjs instance */
5252 popper : null as ReturnType < typeof createPopper > ,
5353 /** timeout id */
54- timeout : null as ReturnType < typeof setTimeout > ,
54+ timeout : null ,
5555 hasDocumentEvent : false ,
5656 /** if a trusted action (opening or closing) is prevented, increase this flag */
5757 visibleState : 0 ,
@@ -194,16 +194,13 @@ export default mixins(classPrefixMixins, getAttachConfigMixins('popup')).extend(
194194 updatePopper ( ) {
195195 const { $el : triggerEl } = this ;
196196 const popperEl = this . $refs . popper as HTMLElement ;
197- const overlayEl = this . $refs . overlay as HTMLElement ;
198- const popperTargetEl = overlayEl || popperEl ;
199-
200- if ( ! popperTargetEl || ! this . visible ) return ;
201197
198+ if ( ! popperEl || ! this . visible ) return ;
202199 if ( this . popper ) {
203200 this . popper . update ( ) ;
204201 return ;
205202 }
206- this . popper = createPopper ( triggerEl , popperTargetEl , {
203+ this . popper = createPopper ( triggerEl , popperEl , {
207204 modifiers :
208205 getIEVersion ( ) > 9
209206 ? [ ]
@@ -348,12 +345,8 @@ export default mixins(classPrefixMixins, getAttachConfigMixins('popup')).extend(
348345 // 子元素存在打开的 popup 时,ui 可能重叠,而 dom 节点多是并列关系
349346 // 需要做碰撞检测去阻止父级 popup 关闭
350347 if ( this . visibleState > 1 ) {
351- // 优先使用实际可见的 overlay 容器进行碰撞检测;
352- // 在某些场景下(如菜单子菜单弹层),popper 容器可能为 0x0(overlay 采用绝对定位脱离文档流),
353- // 这会导致用 popper 计算的矩形始终为 0x0,从而误判离开范围,导致父级过早关闭。
354- const rectTarget = ( this . $refs . overlay as HTMLElement ) || ( this . $refs . popper as HTMLElement ) ;
355- const rect = rectTarget ?. getBoundingClientRect ?.( ) ;
356- if ( rect && ev . x > rect . x && ev . x < rect . x + rect . width && ev . y > rect . y && ev . y < rect . y + rect . height ) return ;
348+ const rect = ( this . $refs . popper as HTMLElement ) . getBoundingClientRect ( ) ;
349+ if ( ev . x > rect . x && ev . x < rect . x + rect . width && ev . y > rect . y && ev . y < rect . y + rect . height ) return ;
357350 }
358351 this . mouseInRange = false ;
359352 this . handleClose ( { } ) ;
0 commit comments