Vue-Layout | Vue visual layout tool based on UI components
kandi X-RAY | Vue-Layout Summary
kandi X-RAY | Vue-Layout Summary
Vue visual layout tool based on UI components
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Vue-Layout
Vue-Layout Key Features
Vue-Layout Examples and Code Snippets
Community Discussions
Trending Discussions on Vue-Layout
QUESTION
I've followed this blog post: Dynamic Vue.js Layout Components to build some layouts using dynamic components.
I've now put a side nav bar into the layout to update the router views. While the nav works, I'm having trouble to show the modified styles of the active link. The component works as expected if I import it into the main page outside of the layout. I guess that's because here it gets remounted with each route change. But in the layout, nothing changes. I assume that's because the layout doesn't rerender when the route changes. I've tried vm.$forceUpdate with no success, so I'm looking for the correct way to get a component to remount itself once it is clicked on (if that is indeed the source of the problem)
UPDATE: I've managed to show this in codesandbox to make it easier to understand: codesandbox.io/s/mqwl3jlvx8
My code looks like this: App.vue:
...ANSWER
Answered 2018-Sep-29 at 10:36With mounted not firing, I solved this by exchanging events between the parent and the NavItem children. As the children are in a v-for loop, I need to set and pass the index as well as a ref in order to fire the event correctly. Now, on route change, the emitting link gets the active style and the other children set themselves to "neutral".
SideNav parent now looks like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Vue-Layout
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page