Giter VIP home page Giter VIP logo

vue-tree-navigation's Introduction

vue-tree-navigation

A Vue.js tree navigation menu

Demo

Features:

  • unlimited number of levels
  • you can define default open level
  • focused on core functionality, only necessary styles included - just apply your own styles like I did for demo page ๐Ÿ˜‰

Installation

$ npm install vue-tree-navigation

main.js

import VueTreeNavigation from 'vue-tree-navigation';

Vue.use(VueTreeNavigation);

Usage

file.vue

<vue-tree-navigation :items="items" :defaultOpenLevel="defaultOpenLevel" />
export default {
  ...
  data() {
    return {
      items: [
        { name: 'First category', children: [
          { name: 'Category item', href: '#take-me-somewhere' },
          { name: 'Category item', href: '#take-me-somewhere' }
        ]},
        { name: 'Second category', href: '#take-me-somewhere' }
      ],
      defaultOpenLevel: 1
    }
  },
  ...
};

items Array

An array containing navigation menu items.

You don't need to specify href field. Menu item will be rendered as a simple value instead of a hyperlink in this case.

defaultOpenLevel Number

Optional. Default value is 0 (everything is closed).

Nuxt

You can use the component in your Nuxt.js project if you disable server-side rendering for your Nuxt plugin:

plugins/vue-tree-navigation.js

import Vue from 'vue';
import VueTreeNavigation from 'vue-tree-navigation';

Vue.use(VueTreeNavigation);

nuxt.config.js

module.exports = {
  ...
  plugins: [
    { src: '~plugins/vue-tree-navigation', ssr: false }
  ],
  ...
}

Developers

Install dependencies:

$ npm install

Run tests:

$ npm run test

Run tests in verbose mode:

$ npm run test:verbose

Run development server:

$ npm run dev

Build:

$ npm run build

Run demo development server:

$ cd demo
$ npm install
$ npm run dev

vue-tree-navigation's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.