File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
packages/floating-vue/src Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,11 @@ const createPopper = () => defineComponent({
277277 type : Number ,
278278 default : defaultPropFactory ( 'disposeTimeout' ) ,
279279 } ,
280+
281+ autoCloseTimeout : {
282+ type : Number ,
283+ default : defaultPropFactory ( 'autoCloseTimeout' ) ,
284+ } ,
280285 } ,
281286
282287 emits : {
@@ -467,12 +472,16 @@ const createPopper = () => defineComponent({
467472 if ( this . parentPopper ) {
468473 this . parentPopper . lockedChild = this
469474 clearTimeout ( this . parentPopper . lockedChildTimer )
470- // this.parentPopper.lockedChildTimer = setTimeout(() => {
471- // if (this.parentPopper.lockedChild !== this) {
472- // this.parentPopper.lockedChild.hide({ skipDelay })
473- // this.parentPopper.lockedChild = null
474- // }
475- // }, 1000)
475+ console . log ( this . autoCloseTimeout )
476+ if ( this . autoCloseTimeout > 0 ) {
477+ console . log ( 'set timeout' )
478+ this . parentPopper . lockedChildTimer = setTimeout ( ( ) => {
479+ if ( this . parentPopper . lockedChild === this ) {
480+ this . parentPopper . lockedChild . hide ( { skipDelay } )
481+ this . parentPopper . lockedChild = null
482+ }
483+ } , this . autoCloseTimeout )
484+ }
476485 }
477486 return
478487 }
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ export const config: FloatingVueConfig = {
3131 arrowPadding : 0 ,
3232 // Compute arrow overflow (useful to hide it)
3333 arrowOverflow : true ,
34+ // Timeout that will trigger the closing of parent popper in (ms - 0 means disabled)
35+ autoCloseTimeout : 1000 ,
3436 /**
3537 * By default, compute autohide on 'click'.
3638 */
You can’t perform that action at this time.
0 commit comments