1.2.0 • Published 7 years ago

@xlaoyu/enhanced-el-tree v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

enhanced-el-tree

Vue 2.x npm npm-downloades license

Base on element-ui's tree component, add some useful function and horizontal-mode

Futures

Horizontal Mode

Or can be said that is multiple-cascader component.Try it Demo demo

restrict:when use horizontal mode,some origin tree property would not take efffect, eg: indent, accordion etc.

Extra Attributes

AttributeDescriptionTypeAccepted ValuesDefault
horizontalwhether to activate horizontal modeBoolean-false
tree-node-wrapper-classadd these class to horizontal block wrapper when activate horizontal modeString--
open-when-checkclick checkbox to behave like a click tree nodeBoolean-false

Extra Useful Methods

NameDescriptionParameters
getAllCheckedKeyslike getCheckedKeys but includes indeterminate nodes
getAllCheckedNodeslike getCheckedNodes but includes indeterminate nodes
setCheckedNodesPreciselyUsually used with getAllCheckedNodes to restore the original state of the treean array of nodes get from getAllCheckedKeys
setCheckedKeysPreciselyUsually used with getAllCheckedKeys to restore the original state of the treean array of keys get from getAllCheckedKeys
getCheckedKeysWithoutChildget checked node except all child checked nodes, look at the example below
getCheckedNodesWithoutChildditto

getCheckedKeysWithoutChild example:

/**
 *
 * @example
 *  level1 - intermediate
 *    level1.1 - checked
 *      level1.1.1 - checked
 *      level1.1.2 - checked
 *    level1.2 - checked
 *    level1.3 - intermediate
 *      level1.3.1 - checked
 *      level1.3.2 - not checked
 *    level1.4 - not checked
 *  level2 - checked
 *
 *  getCheckedKeysWithoutChild() will return [level2, level1.1, level1.2, level1.3.1]
 */

Installation

$ npm install @xlaoyu/enhanced-el-tree -D

Usage

<template>
  <enhanced-el-tree horizontal></enhanced-el-tree>
</template>

<script>
import EnhancedElTree from '@xlaoyu/enhanced-el-tree';

// component constructor
{
  name: 'FooComponent',
  components: {
    EnhancedElTree
  }
}
</script>

Denpencics

Vue@2.5.13

Element@2.2.1

License

MIT @ xlaoyu

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago