kTree 是一个移动端树组件,可作为企业组织通讯录,课程目录 etc.
import mTree from 'vue-mobile-tree';
import 'vue-mobile-tree/lib/vue-mobile-tree.css';
Vue.use(mTree);
<m-tree
:data="data"
:options="options"
@click="onClick"
@change="onChange"
@selected="onSelected"
>
<template #label="{ node }">
<span>{{node.title}}</span>
<span v-if="!node.isLeaf">({{node.origin.count}})</span>
</template>
</m-tree>
data() {
return {
options: {},
data: [
{
key: 100001,
title: 'XX公司',
parentid: -1,
},
{
key: 100002,
title: '北京分公司',
parentid: 100001,
},
{
key: 100003,
title: '上海分公司',
parentid: 100001,
},
{
key: 100003100001,
title: '张三',
parentid: 100001,
isLeaf: true
},
{
key: 100001100002,
title: '李四',
parentid: 100001,
isLeaf: true
},
{
key: 100002100001,
title: '王五',
parentid: 100002,
isLeaf: true
},
],
};
}