File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ const EVENT_KEY = `.${DATA_KEY}`
2424
2525const EVENT_EXPANDED = `expanded${ EVENT_KEY } `
2626const EVENT_COLLAPSED = `collapsed${ EVENT_KEY } `
27- // const EVENT_LOAD_DATA_API = `load${EVENT_KEY}`
27+ const EVENT_LOAD_DATA_API = `load${ EVENT_KEY } `
2828
2929const CLASS_NAME_MENU_OPEN = 'menu-open'
3030const SELECTOR_NAV_ITEM = '.nav-item'
@@ -112,6 +112,18 @@ class Treeview {
112112 */
113113
114114onDOMContentLoaded ( ( ) => {
115+ const openMenuItems = document . querySelectorAll ( `${ SELECTOR_NAV_ITEM } .${ CLASS_NAME_MENU_OPEN } ` )
116+
117+ openMenuItems . forEach ( menuItem => {
118+ const childElement = menuItem . querySelector ( SELECTOR_TREEVIEW_MENU ) as HTMLElement | undefined
119+ if ( childElement ) {
120+ slideDown ( childElement , 0 )
121+
122+ const event = new Event ( EVENT_LOAD_DATA_API )
123+ menuItem . dispatchEvent ( event )
124+ }
125+ } )
126+
115127 const button = document . querySelectorAll ( SELECTOR_DATA_TOGGLE )
116128
117129 button . forEach ( btn => {
You can’t perform that action at this time.
0 commit comments