Coder Social home page Coder Social logo

vue-tree's Introduction

vue-tree

vue 编写的树形菜单,小巧实用,支持vue1.0,vue2.0

v1.0 功能:  
1.支持多级树目录  
2.支持高亮点击的节点  
3.支持展开点击节点  
4.支持点击收缩节点时收缩所有子目录  
5.支持自定义回调函数,点击节点时回调,参数为节点信息  

用法:<launch-tree :list='list' :options='options'></launch-tree>

list = [
    {
        name: '一级目录', // 目录名字
        isOpen: true, // 是否初始展开目录
        hightLight: true, // 是否初始高亮
        className: undefined, // 添加自定义样式
        childs: [], // 二级目录
        ...{} // 其他用户额外参数 
    }
]
options = {
    callback: undefined // 自定义点击事件,callback(node)
}

图示:

示例:

<template>
  <div>
    <launch-tree :list='list' :options='options'></launch-tree>
  </div>
</template>

<script>
import launchTree from '../components/launch_tree.vue'

const COMPONENT_NAME = 'Login'
let list = [
  {
    name: '一级目录', // 目录名字
    isOpen: true, // 是否初始展开目录
    hightLight: true, // 是否初始高亮
    className: undefined, // 添加自定义样式
    ...{}, // 其他用户额外参数
    childs: [ // 二级目录
      {
        name: '二级目录1',
        isOpen: false
      },
      {
        name: '二级目录2'
      },
      {
        name: '二级目录3'
      }
    ]
  },
  {
    name: '二级目录', // 目录名字
    isOpen: true, // 是否初始展开目录
    hightLight: true, // 是否初始高亮
    className: undefined, // 添加自定义样式
    ...{}, // 其他用户额外参数
    childs: [ // 二级目录
      {
        name: '二级目录1',
        isOpen: false
      },
      {
        name: '二级目录2'
      },
      {
        name: '二级目录3'
      }
    ]
  }
]

let options = {
  callback: undefined // 自定义点击事件,callback(node)
}

export default {
  name: COMPONENT_NAME,
  data () {
    return {
      list: list,
      options: options
    }
  },
  components: {
    launchTree
  }
}

</script>

vue-tree's People

Contributors

stephen1993 avatar xyyh avatar

Watchers

James Cloos 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.