refactor: improve the scrollbar behavior
This commit is contained in:
+2
-1
@@ -12,7 +12,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
|
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite --force",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"lint": "eslint \"src/**/*.{js,vue}\"",
|
"lint": "eslint \"src/**/*.{js,vue}\"",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
"@coreui/vue-chartjs": "^3.0.0-rc.0",
|
"@coreui/vue-chartjs": "^3.0.0-rc.0",
|
||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
"chart.js": "^4.4.0",
|
"chart.js": "^4.4.0",
|
||||||
|
"simplebar-vue": "^2.3.3",
|
||||||
"vue": "^3.3.9",
|
"vue": "^3.3.9",
|
||||||
"vue-router": "^4.2.5",
|
"vue-router": "^4.2.5",
|
||||||
"vuex": "^4.1.0"
|
"vuex": "^4.1.0"
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
import { defineComponent, h, onMounted, ref, resolveComponent } from 'vue'
|
import { defineComponent, h, onMounted, ref, resolveComponent } from 'vue'
|
||||||
import { RouterLink, useRoute } from 'vue-router'
|
import { RouterLink, useRoute } from 'vue-router'
|
||||||
|
|
||||||
import {
|
import { CBadge, CSidebarNav, CNavItem, CNavGroup, CNavTitle } from '@coreui/vue'
|
||||||
CBadge,
|
|
||||||
CSidebarNav,
|
|
||||||
CNavItem,
|
|
||||||
CNavGroup,
|
|
||||||
CNavTitle,
|
|
||||||
} from '@coreui/vue'
|
|
||||||
import nav from '@/_nav.js'
|
import nav from '@/_nav.js'
|
||||||
|
|
||||||
|
import simplebar from 'simplebar-vue'
|
||||||
|
import 'simplebar-vue/dist/simplebar.min.css'
|
||||||
|
|
||||||
const normalizePath = (path) =>
|
const normalizePath = (path) =>
|
||||||
decodeURI(path)
|
decodeURI(path)
|
||||||
.replace(/#.*$/, '')
|
.replace(/#.*$/, '')
|
||||||
@@ -62,6 +59,7 @@ const AppSidebarNav = defineComponent({
|
|||||||
return h(
|
return h(
|
||||||
CNavGroup,
|
CNavGroup,
|
||||||
{
|
{
|
||||||
|
as: 'div',
|
||||||
compact: true,
|
compact: true,
|
||||||
...(firstRender.value && {
|
...(firstRender.value && {
|
||||||
visible: item.items.some((child) => isActiveItem(route, child)),
|
visible: item.items.some((child) => isActiveItem(route, child)),
|
||||||
@@ -93,6 +91,7 @@ const AppSidebarNav = defineComponent({
|
|||||||
resolveComponent(item.component),
|
resolveComponent(item.component),
|
||||||
{
|
{
|
||||||
active: props.isActive,
|
active: props.isActive,
|
||||||
|
as: 'div',
|
||||||
href: props.href,
|
href: props.href,
|
||||||
onClick: () => props.navigate(),
|
onClick: () => props.navigate(),
|
||||||
},
|
},
|
||||||
@@ -103,11 +102,7 @@ const AppSidebarNav = defineComponent({
|
|||||||
customClassName: 'nav-icon',
|
customClassName: 'nav-icon',
|
||||||
name: item.icon,
|
name: item.icon,
|
||||||
})
|
})
|
||||||
: h(
|
: h('span', { class: 'nav-icon' }, h('span', { class: 'nav-icon-bullet' })),
|
||||||
'span',
|
|
||||||
{ class: 'nav-icon' },
|
|
||||||
h('span', { class: 'nav-icon-bullet' }),
|
|
||||||
),
|
|
||||||
item.name,
|
item.name,
|
||||||
item.badge &&
|
item.badge &&
|
||||||
h(
|
h(
|
||||||
@@ -127,7 +122,9 @@ const AppSidebarNav = defineComponent({
|
|||||||
)
|
)
|
||||||
: h(
|
: h(
|
||||||
resolveComponent(item.component),
|
resolveComponent(item.component),
|
||||||
{},
|
{
|
||||||
|
as: 'div',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
default: () => item.name,
|
default: () => item.name,
|
||||||
},
|
},
|
||||||
@@ -137,7 +134,9 @@ const AppSidebarNav = defineComponent({
|
|||||||
return () =>
|
return () =>
|
||||||
h(
|
h(
|
||||||
CSidebarNav,
|
CSidebarNav,
|
||||||
{},
|
{
|
||||||
|
as: simplebar,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
default: () => nav.map((item) => renderItem(item)),
|
default: () => nav.map((item) => renderItem(item)),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user