Skip to content

Commit 0094f30

Browse files
committed
refactor(datepicker): Simplify handleClickOutside() method
1 parent 95a8bfe commit 0094f30

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/Datepicker.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,14 +525,21 @@ export default {
525525
return
526526
}
527527
528+
const closeByClickOutside = () => {
529+
this.isClickOutside = true
530+
this.close()
531+
}
532+
528533
if (!this.globalDatepickerId) {
529-
this.closeByClickOutside()
534+
closeByClickOutside()
530535
return
531536
}
532537
533538
if (document.datepickerId.toString() === this.datepickerId) {
534539
this.$nextTick(() => {
535-
this.closeIfNotFocused()
540+
if (!this.isActive) {
541+
closeByClickOutside()
542+
}
536543
})
537544
}
538545
},

0 commit comments

Comments
 (0)