# m-tree
#### 本组件为 leo-tree 增强版
#### 本插件基于 作者: leo9012 发行的leo-tree v1.0.1
#### email:121959858@qq.com
#### props
#### data 数据源
#### defaultProps 配置选项,return { id: 'id', label: 'label', children: 'children' }
#### emit
#### 参数:
:data tree数据原{id:1,
label:'',
children:[]} 每个节点必须有children,无子节点设置为[];
:divider 开启节点间分割线, true or false; 不设置为false;
:edit 开启编辑功能,数据true or false; 不设置为false;
:unfold 控制默认展开状态, true 为默认展开状态 or false为默认收缩状态; 不设置为false;
开启后在节点右边增加 + - ↑ ↓按钮,可以绑定up-item down-item add-item,delete-item,long-press事件;
#### 方法:
@node-click 监听节点点击事件 返回节点数据 {id: id, label: label, pid: pid,* 节点所有数据};
@up-item 监听节点up上移事件 返回节点数据{item: this.item, items: this.items, index: this.index};
@down-item 监听节点down下移事件 返回节点数据 {item: this.item, items: this.items, index: this.index};
@add-item 监听节点新增事件 返回节点数据 {id: id, label: label, pid: pid,* 节点所有数据}; id:0时根节点新增,id:x, 为对应x节点建立子节点;
@edit-item 监听节点编辑事件 返回节点ID {id: id, label: label, pid: pid,* 节点所有数据};
@delete-item 监听节点删除事件 返回节点ID {id: id};
@finger-action 监听节点滑动事件 返回节点数据 {item:选择节点数据, items: 选择节点同级列表,action:number}; action:1上滑, 2下滑,3左滑,4右滑
@long-press 监听节点长按事件 返回节点数据 {id: id, label: label, pid: pid,* 节点所有数据};
### 使用
#### 本组件符合easycom规范,HBuilderX 2.5.5起,只需将本组件导入项目,在页面template中即可直接使用,无需在页面中import和注册components。