Comments (5)
In AppSidebarNav.js code is look like this:
{
default: (props) => h(
resolveComponent(item.component),
{
active: props.isActive,
href: props.href,
onClick: () => props.navigate(),
},
{
default: () => [
item.icon &&
h(resolveComponent('CIcon'), {
customClassName: 'nav-icon',
name: item.icon,
}),
item.name,
item.badge &&
h(
CBadge,
{
class: 'ms-auto',
color: item.badge.color,
},
{
default: () => item.badge.text,
},
),
],
},
),
},
You can customize the child item using render function h. Here is my code that does the trick:
{
default: (props) => h(
resolveComponent(item.component),
{
active: props.isActive,
},
{
default: () => h(
RouterLink,
{
to: props.href,
class: 'nav-link',
onClick: () => props.navigate(),
},
{
default: () => [
item.icon &&
h(resolveComponent('CIcon'), {
customClassName: 'nav-icon',
name: item.icon,
}),
item.name,
item.badge &&
h(
CBadge,
{
class: 'ms-auto',
color: item.badge.color,
},
{
default: () => item.badge.text,
},
),
],
},
),
},
),
},
I have removed href and onClick props from the original code. And shifted them into RouterLink render function and href converted to "to" attribute for RouterLink. For css added the class nav-link.
That does the trick.
Hope it helps.
from coreui-free-vue-admin-template.
I checked AppSidebarNav.js and set custom
prop to false in h function that creates RouterLink
.
It solves 2 problems and creates 2 problems.
Solved problems:
1- createWebHistory is working well. I can use template's routes without that # sign.
2- router.beforeEach was triggered twice before I set 'custom' prop to false. Now it triggers only once. Noice.
Created problems:
1- custom
prop's definition in node_modules>vue router>...RouterLink
says:
Whether RouterLink should not wrap its content in an a
tag. Useful when using v-slot
to create a custom RouterLink
Therefore now all sidebar li
tags are wrapped in a
tag. It is not a valid html (ul>a>li) but also it seems doesn't affect anything badly (except styles, i removed underline of li
's wrapper a
with css)
2- breadcrumb and other components that has router-link are working like my first comment. i guess they all have this custom
property :(
from coreui-free-vue-admin-template.
@zeeforum Yes it helped, thank you!
from coreui-free-vue-admin-template.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions
from coreui-free-vue-admin-template.
Links doesn't work properly with history: createWebHistory
The issue not resolved yet.
from coreui-free-vue-admin-template.
Related Issues (20)
- I can't change the table-filter-label in CSmartTable HOT 1
- Error loading vue.config.js: HOT 8
- npm run serve - error HOT 1
- mobile page is disabled after sidebar hide HOT 3
- Sidebar change color schema doesn't work HOT 3
- Replace VueX with Pinia HOT 2
- Have older versions been deleted from NPM? HOT 2
- Trigger modal from CSideBar HOT 1
- How about with nuxt 3? HOT 1
- CDataTable replacement? HOT 3
- Recently im receiving some error in my custuom core.ui & vuejs admin app. The error is : Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
- An error about getComputedStyle. HOT 3
- Installation failed when using node 18 or node 16 HOT 2
- How to configure axios with .env here ??? HOT 1
- license issues HOT 1
- custom validation HOT 1
- $refs not access CFormInput Component HOT 1
- Links doesn't work properly with history: createWebHistory
- Links doesn't work properly with history: createWebHistory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coreui-free-vue-admin-template.