File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,12 @@ export interface MenuOptions {
124124 * If your element in menu item has this className, click it will ignore event.
125125 */
126126 ignoreClickClassName ?: string ,
127+ /**
128+ * Set should close menu when the user click on other places.
129+ *
130+ * @default true
131+ */
132+ clickCloseOnOutside ?: boolean ;
127133 /**
128134 * If your element in menu item has this className, click it will ignore event and close hole menu.
129135 */
@@ -206,12 +212,12 @@ export interface MenuOptions {
206212 * ```
207213 */
208214 getContainer ?: HTMLElement | ( ( ) => HTMLElement ) ;
215+
209216 /**
210217 * This event emit when this menu is closing. (Usually used in function mode)
211218 * @param lastClickItem The last clicked menu item, if user does not click any item, it is `undefined`. This param only valid in function mode.
212219 */
213220 onClose ?: ( ( lastClickItem : MenuItem | undefined ) => void ) | undefined ;
214-
215221 /**
216222 * Event for MenuBar component
217223 */
Original file line number Diff line number Diff line change @@ -171,10 +171,11 @@ export default defineComponent({
171171 return ;
172172 target = target .parentNode as HTMLElement ;
173173 }
174-
175- // Close menu
176- removeBodyEvents ();
177- closeMenu ();
174+ if (options .value .clickCloseOnOutside !== false ) {
175+ // Close menu
176+ removeBodyEvents ();
177+ closeMenu ();
178+ }
178179 }
179180
180181 // provide globalOptions for child use
You can’t perform that action at this time.
0 commit comments