mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-08 12:56:27 +08:00
Fix nested general dropdown [SCI-12250]
This commit is contained in:
parent
0a2a1a6d69
commit
dc4e4bcae8
1 changed files with 4 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
||||||
<template v-if="isOpen">
|
<template v-if="isOpen">
|
||||||
<teleport to="body">
|
<teleport to="body">
|
||||||
<div @click="closeOnClick && closeMenu()" ref="flyout"
|
<div @click="closeOnClick && closeMenu()" ref="flyout"
|
||||||
|
:id="randomId"
|
||||||
class="sn-dropdown fixed z-[3000] bg-sn-white inline-block
|
class="sn-dropdown fixed z-[3000] bg-sn-white inline-block
|
||||||
rounded p-2.5 sn-shadow-menu-sm"
|
rounded p-2.5 sn-shadow-menu-sm"
|
||||||
:class="{
|
:class="{
|
||||||
|
@ -42,7 +43,8 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isOpen: false
|
isOpen: false,
|
||||||
|
randomId: `dropdown-${Math.random().toString(36).substring(2, 15)}`,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
|
@ -70,7 +72,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closeMenu(e) {
|
closeMenu(e) {
|
||||||
if (e && e.target.closest('.sn-dropdown, .sn-select-dropdown, .sn-menu-dropdown, .dp__instance_calendar')) return;
|
if (e && e.target.closest(`.sn-dropdown#${this.randomId}, .sn-select-dropdown, .sn-menu-dropdown, .dp__instance_calendar`)) return;
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue