树状图插件
vtree
data:
instance methods:
Feature
no-dependence and built-in css
virtual DOM, less DOM touch
development
tree component 树状图插件
演示地址download vtree.min.js
import vtree.min.js
<script src="vtree.min.js"></script>
init tree
const tree = vTree.init({
el: document.getElementById('container'),
data: [],
showCheckbox: true,
onCheck: function (checkedNodes, event) {
//
}
})
API
vTree.init(option) return a vTree instance.
option:
attr | desc | type | default |
---|---|---|---|
el | tree's container | Element | - |
data | tree data | Array | - |
showCheckbox | if show checkbox | Boolean | true |
slice | if title.length more than this number, show ellipsis | Number | - |
onCheck | execute when clicking checkbox, with 2 arguments: checkedNodes, origin event | Function | - |
attr | desc | type | default |
---|---|---|---|
title | the text of tree node | String | - |
expand | if expand node | Boolean | true |
checked | if this node is checked (and its children will be checked) | Boolean | false |
disabled | if this node is disabled (and its children will be disabled) | Boolean | false |
children | nested children, same with data | Array | - |
method | desc | arguments |
---|---|---|
getCheckedNodes | return an Array of checked nodes | none |
checkAll | check all nodes, except disabled nodes | none |
cancelAll | cancel all checked nodes, except disabled nodes | none |
npm install
npm run dev
npm run build
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。