@@ -40,15 +40,13 @@ export default defineComponent({
4040 const  root  =  menuRoot . value  as  unknown  as  HTMLElement ; 
4141 const  children  =  root . children ; 
4242 const  container  =  overflowContainer . children [ 1 ] ; 
43-  let  preItem : HTMLElement  |  null ; 
4443 const  ob  =  new  IntersectionObserver ( 
4544 ( entries : IntersectionObserverEntry [ ] )  =>  { 
4645 entries . forEach ( ( v : IntersectionObserverEntry )  =>  { 
4746 if  ( ! v . isIntersecting )  { 
4847 const  cloneNode  =  v . target . cloneNode ( true )  as  Element  as  HTMLElement ; 
49-  preItem  =  v . target  as  Element  as  HTMLElement ; 
5048 if  ( v . target . classList . contains ( `${ ns . b ( ) }  ) ) { 
51-  if  ( flag  &&  v . target . previousElementSibling ) { 
49+  if  ( flag  &&  v . target . previousElementSibling   &&   container . children . length ) { 
5250 root . appendChild ( v . target . previousElementSibling ) ; 
5351 }  else  { flag  =  true ; } 
5452 }  else  { 
@@ -66,10 +64,11 @@ export default defineComponent({
6664 ! v . target . classList . contains ( `${ ns . b ( ) }  )  && 
6765 ( v . target  as  HTMLElement ) . style . visibility  ===  'hidden' 
6866 )  { 
69-  console . log ( v . target ,  preItem ,  v . target  ===  preItem ) ; 
7067 ob . unobserve ( v . target ) ; 
71-  const  el  =  container . children [ container . children . length  -  1 ] ; 
72-  root . insertBefore ( el ,  overflowContainer ) ; 
68+  const  el  =  container . lastChild ; 
69+  if  ( el ) { 
70+  root . insertBefore ( el ,  overflowContainer ) ; 
71+  } 
7372 const  obItem  =  overflowContainer . previousElementSibling ; 
7473 if  ( obItem )  { 
7574 ob . observe ( obItem ) ; 
@@ -78,7 +77,6 @@ export default defineComponent({
7877 const  sub  =  obItem ; 
7978 const  wrapper  =  obItem . children [ 1 ]  as  HTMLElement ; 
8079 ( sub  as  HTMLElement ) . addEventListener ( 'mouseenter' ,  ( ev : MouseEvent )  =>  { 
81-  console . log ( 'emit' ) ; 
8280 ev . stopPropagation ( ) ; 
8381 useShowSubMenu ( 'mouseenter' ,  ev ,  wrapper ) ; 
8482 } ) ; 
0 commit comments