mirror of https://github.com/ColorlibHQ/AdminLTE
fix initial slideUp glitch in treeview
parent
3001b30742
commit
b17340cdf0
|
@ -24,7 +24,7 @@ const EVENT_KEY = `.${DATA_KEY}`
|
|||
|
||||
const EVENT_EXPANDED = `expanded${EVENT_KEY}`
|
||||
const EVENT_COLLAPSED = `collapsed${EVENT_KEY}`
|
||||
// const EVENT_LOAD_DATA_API = `load${EVENT_KEY}`
|
||||
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}`
|
||||
|
||||
const CLASS_NAME_MENU_OPEN = 'menu-open'
|
||||
const SELECTOR_NAV_ITEM = '.nav-item'
|
||||
|
@ -112,6 +112,18 @@ class Treeview {
|
|||
*/
|
||||
|
||||
onDOMContentLoaded(() => {
|
||||
const openMenuItems = document.querySelectorAll(`${SELECTOR_NAV_ITEM}.${CLASS_NAME_MENU_OPEN}`)
|
||||
|
||||
openMenuItems.forEach(menuItem => {
|
||||
const childElement = menuItem.querySelector(SELECTOR_TREEVIEW_MENU) as HTMLElement | undefined
|
||||
if (childElement) {
|
||||
slideDown(childElement, 0)
|
||||
|
||||
const event = new Event(EVENT_LOAD_DATA_API)
|
||||
menuItem.dispatchEvent(event)
|
||||
}
|
||||
})
|
||||
|
||||
const button = document.querySelectorAll(SELECTOR_DATA_TOGGLE)
|
||||
|
||||
button.forEach(btn => {
|
||||
|
|
Loading…
Reference in New Issue