1
1
import { defineComponent , h , onMounted , ref , resolveComponent } from 'vue'
2
2
import { RouterLink , useRoute } from 'vue-router'
3
3
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'
11
5
import nav from '@/_nav.js'
12
6
7
+ import simplebar from 'simplebar-vue'
8
+ import 'simplebar-vue/dist/simplebar.min.css'
9
+
13
10
const normalizePath = ( path ) =>
14
11
decodeURI ( path )
15
12
. replace ( / # .* $ / , '' )
@@ -62,6 +59,7 @@ const AppSidebarNav = defineComponent({
62
59
return h (
63
60
CNavGroup ,
64
61
{
62
+ as : 'div' ,
65
63
compact : true ,
66
64
...( firstRender . value && {
67
65
visible : item . items . some ( ( child ) => isActiveItem ( route , child ) ) ,
@@ -93,6 +91,7 @@ const AppSidebarNav = defineComponent({
93
91
resolveComponent ( item . component ) ,
94
92
{
95
93
active : props . isActive ,
94
+ as : 'div' ,
96
95
href : props . href ,
97
96
onClick : ( ) => props . navigate ( ) ,
98
97
} ,
@@ -103,11 +102,7 @@ const AppSidebarNav = defineComponent({
103
102
customClassName : 'nav-icon' ,
104
103
name : item . icon ,
105
104
} )
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' } ) ) ,
111
106
item . name ,
112
107
item . badge &&
113
108
h (
@@ -127,7 +122,9 @@ const AppSidebarNav = defineComponent({
127
122
)
128
123
: h (
129
124
resolveComponent ( item . component ) ,
130
- { } ,
125
+ {
126
+ as : 'div' ,
127
+ } ,
131
128
{
132
129
default : ( ) => item . name ,
133
130
} ,
@@ -137,7 +134,9 @@ const AppSidebarNav = defineComponent({
137
134
return ( ) =>
138
135
h (
139
136
CSidebarNav ,
140
- { } ,
137
+ {
138
+ as : simplebar ,
139
+ } ,
141
140
{
142
141
default : ( ) => nav . map ( ( item ) => renderItem ( item ) ) ,
143
142
} ,
0 commit comments