1.0.0 • Published 5 years ago

@orez/vue-org-tree v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

vue-org-tree

A simple organization tree chart based on Vue2.x

Usage

NPM

# use npm
npm i @orez/vue2-org-tree

# use yarn
yarn add @orez/vue2-org-tree

Import Plugins

import Vue from 'vue'
import OrgTree from '@orez/vue-org-tree'
import '@orez/vue-org-tree/style.css'

Vue.use(OrgTree)

// ...

API

props

propdescriptontypedefault
dataObject{label: '', expand: false, children: []}
propsconfigure propsObject{label: 'label', children: 'children', expand: 'expand'}
labelWidthnode label widthString | Numberauto
collapsablechildren node is collapsableBooleantrue
renderContenthow to render node labelFunction-
labelClassNamenode label classFunction | String-
selectedKeyThe key of the selected nodeString-
selectedClassNameThe className of the selected nodeFunction | String-

events

event namedescriptontype
clickClick eventFunction
mouseoveronMouseOver eventFunction
mouseoutonMouseOut eventFunction

Call events

on-expand

well be called when the collapse-btn clicked

  • params e Event
  • params data Current node data

on-node-click

well be called when the node-label clicked

  • params e Event
  • params data Current node data

on-node-mouseover

It is called when the mouse hovers over the label.

  • params e Event
  • params data Current node data

on-node-mouseout

It is called when the mouse leaves the label.

  • params e Event
  • params data Current node data

Example

  • default

    default

  • horizontal

    horizontal

Browser support

use table layout!

IE9+、Chrome、Firefox、Opera

License

MIT