Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
vue-tree-navigation
Advanced tools
Vue.js 2 tree navigation with vue-router support
For more detailed information see documentation/demo
NavigationItem--active
, NavigationLevel--level-1
, NavigationLevel--closed
)Let's suppose you use vue-router with the following routes definition
const routes = [
{
name: 'Home',
path: '/',
},
{
name: 'Running',
path: '/running',
children: [
{
name: 'Barefoot',
path: 'barefoot',
},
],
},
{
name: 'Yoga',
path: '/yoga',
children: [
{
name: 'Mats',
path: 'mats',
},
{
name: 'Tops',
path: 'tops',
},
],
},
{
name: 'About',
path: '/about',
children: [
{
name: 'Career',
path: 'career',
children: [
{
name: 'Design',
path: 'design',
},
],
},
],
},
];
Then simply include vue-tree-navigation
<template>
<vue-tree-navigation />
</template>
and it will generate the following menu:
- Home // --> /
- Running // --> /running
- Barefoot // --> /running/barefoot
- Yoga // --> /yoga
- Mats // --> /yoga/mats
- Tops // --> /yoga/tops
- About // --> /about
- Career // --> /about/career
- Design // --> /about/career/design
Do not forget to use named routes since vue-tree-navigation uses name
field to label navigation items.
The following configuration
<template>
<vue-tree-navigation :items="items" />
</template>
<script>
export default {
data() {
return {
items: [
{ name: 'Products', children: [
{ name: 'Shoes', path: 'shoes' }
]},
{ name: 'About', path: 'about', children: [
{ name: 'Contact', path: 'contact', children: [
{ name: 'E-mail', element: 'email' },
{ name: 'Phone', element: 'phone' }
]},
]},
{ name: 'Github', external: 'https://github.com' },
],
};
},
};
</script>
will generate
- Products // category label
- Shoes // --> /shoes
- About // --> /about
- Contact // --> /about/contact
- E-mail // --> /about/contact#email
- Phone // --> /about/contact#phone
- Github // --> https://github.com
For more examples see documentation/demo
$ npm install vue-tree-navigation
main.js
import VueTreeNavigation from 'vue-tree-navigation';
Vue.use(VueTreeNavigation);
<script src="https://unpkg.com/vue-tree-navigation@4.0.0/dist/vue-tree-navigation.js"></script>
<script>
Vue.use(VueTreeNavigation)
</script>
Example
<div id="app">
<vue-tree-navigation :items="items" :defaultOpenLevel="1" />
</div>
<script>
Vue.use(VueTreeNavigation)
const app = new Vue({
el: '#app',
data: {
items: [
...
],
}
})
</script>
$ yarn dev
$ yarn build
$ yarn prettier
$ yarn lint
$ yarn unit
$ yarn unit --verbose
$ yarn e2e
FAQs
Vue.js 2 tree navigation
The npm package vue-tree-navigation receives a total of 234 weekly downloads. As such, vue-tree-navigation popularity was classified as not popular.
We found that vue-tree-navigation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.