File tree 2 files changed +15
-6
lines changed
packages/floating-vue/src
2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,11 @@ const createPopper = () => defineComponent({
277
277
type : Number ,
278
278
default : defaultPropFactory ( 'disposeTimeout' ) ,
279
279
} ,
280
+
281
+ autoCloseTimeout : {
282
+ type : Number ,
283
+ default : defaultPropFactory ( 'autoCloseTimeout' ) ,
284
+ } ,
280
285
} ,
281
286
282
287
emits : {
@@ -467,12 +472,14 @@ const createPopper = () => defineComponent({
467
472
if ( this . parentPopper ) {
468
473
this . parentPopper . lockedChild = this
469
474
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
+ if ( this . autoCloseTimeout > 0 ) {
476
+ this . parentPopper . lockedChildTimer = setTimeout ( ( ) => {
477
+ if ( this . parentPopper . lockedChild === this ) {
478
+ this . parentPopper . lockedChild . hide ( { skipDelay } )
479
+ this . parentPopper . lockedChild = null
480
+ }
481
+ } , this . autoCloseTimeout )
482
+ }
476
483
}
477
484
return
478
485
}
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ export const config: FloatingVueConfig = {
31
31
arrowPadding : 0 ,
32
32
// Compute arrow overflow (useful to hide it)
33
33
arrowOverflow : true ,
34
+ // Timeout that will trigger the closing of parent popper in (ms - 0 means disabled)
35
+ autoCloseTimeout : 1000 ,
34
36
/**
35
37
* By default, compute autohide on 'click'.
36
38
*/
You can’t perform that action at this time.
0 commit comments