GitHub

Original file line numberDiff line numberDiff line change

@@ -31,6 +31,11 @@ export interface DashboardSidebarProps<T extends DashboardSidebarMode = Dashboar

3131

* @defaultValue 'left'

3232

*/

3333

toggleSide?: 'left' | 'right'

34+

/**

35+

* Automatically close when route changes.

36+

* @defaultValue true

37+

*/

38+

autoClose?: boolean

3439

class?: any

3540

ui?: DashboardSidebar['slots']

3641

}

@@ -66,6 +71,7 @@ defineOptions({ inheritAttrs: false })

6671

const props = withDefaults(defineProps<DashboardSidebarProps<T>>(), {

6772

side: 'left',

6873

mode: 'slideover' as never,

74+

autoClose: true,

6975

toggle: true,

7076

toggleSide: 'left',

7177

minSize: 10,

@@ -111,6 +117,8 @@ watch(open, () => dashboardContext.sidebarOpen!.value = open.value, { immediate:

111117

watch(isCollapsed, () => dashboardContext.sidebarCollapsed!.value = isCollapsed.value, { immediate: true })

112118
113119

watch(() => route.fullPath, () => {

120+

if (!props.autoClose) return

121+
114122

open.value = false

115123

})

116124

Read the original on github.com ↗