基于vue2.x编写的tree树形组件,支持同时选中多个节点,支持保持单一节点打开
属性名 | 描述 | 类型 | 默认值 |
---|---|---|---|
tree-list | tree源数据 | Array | 空 |
isSiblings | 是否保持单一节点展开 | Boolean | false |
isCheckBox | 是否可以多选 | Boolean | false |
callback | 事件回调 | Function | null |
参数名 | 说明 |
---|---|
thisNode | 当前点击节点对象 |
treeData | 所有节点对象 |
type | 'click': 单击事件,'dbclick':双击事件,'open':节点打开关闭事件 |
treeList: [{
id: 0,
clickNode: false,
isFolder: false,
parentId: -1,
parentName: '',
userId: 101,
userName: 'A级用户1',
children: [{
id: 1,
clickNode: false,
isFolder: false,
parentId: 101,
parentName: 'A级用户1',
userId: 201,
userName: 'B级用户1',
children: [{
id: 11,
clickNode: false,
isFolder: false,
parentId: 201,
parentName: 'B级用户2',
userId: 311,
userName: 'C级用户11',
children: []
}]
},{
id: 2,
clickNode: false,
isFolder: false,
parentId: 101,
parentName: 'A级用户1',
userId: 202,
userName: 'B级用户2',
children: [{
id: 3,
clickNode: false,
isFolder: false,
parentId: 202,
parentName: 'B级用户2',
userId: 301,
userName: 'C级用户1',
children: []
}]
}]
}]
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
For a detailed explanation on how things work, check out the guide and docs for vue-loader.