11import { defineComponent , h , onMounted , ref , resolveComponent } from 'vue'
22import { RouterLink , useRoute } from 'vue-router'
33
4- import {
5- CBadge ,
6- CSidebarNav ,
7- CNavItem ,
8- CNavGroup ,
9- CNavTitle ,
10- } from '@coreui/vue'
4+ import { CBadge , CSidebarNav , CNavItem , CNavGroup , CNavTitle } from '@coreui/vue'
115import nav from '@/_nav.js'
126
7+ import simplebar from 'simplebar-vue'
8+ import 'simplebar-vue/dist/simplebar.min.css'
9+
1310const normalizePath = ( path ) =>
1411 decodeURI ( path )
1512 . replace ( / # .* $ / , '' )
@@ -62,6 +59,7 @@ const AppSidebarNav = defineComponent({
6259 return h (
6360 CNavGroup ,
6461 {
62+ as : 'div' ,
6563 compact : true ,
6664 ...( firstRender . value && {
6765 visible : item . items . some ( ( child ) => isActiveItem ( route , child ) ) ,
@@ -93,6 +91,7 @@ const AppSidebarNav = defineComponent({
9391 resolveComponent ( item . component ) ,
9492 {
9593 active : props . isActive ,
94+ as : 'div' ,
9695 href : props . href ,
9796 onClick : ( ) => props . navigate ( ) ,
9897 } ,
@@ -103,11 +102,7 @@ const AppSidebarNav = defineComponent({
103102 customClassName : 'nav-icon' ,
104103 name : item . icon ,
105104 } )
106- : h (
107- 'span' ,
108- { class : 'nav-icon' } ,
109- h ( 'span' , { class : 'nav-icon-bullet' } ) ,
110- ) ,
105+ : h ( 'span' , { class : 'nav-icon' } , h ( 'span' , { class : 'nav-icon-bullet' } ) ) ,
111106 item . name ,
112107 item . badge &&
113108 h (
@@ -127,7 +122,9 @@ const AppSidebarNav = defineComponent({
127122 )
128123 : h (
129124 resolveComponent ( item . component ) ,
130- { } ,
125+ {
126+ as : 'div' ,
127+ } ,
131128 {
132129 default : ( ) => item . name ,
133130 } ,
@@ -137,7 +134,9 @@ const AppSidebarNav = defineComponent({
137134 return ( ) =>
138135 h (
139136 CSidebarNav ,
140- { } ,
137+ {
138+ as : simplebar ,
139+ } ,
141140 {
142141 default : ( ) => nav . map ( ( item ) => renderItem ( item ) ) ,
143142 } ,
0 commit comments