element tree grid
1.0.0
树形网格使用vue
扩展element
ui
<el-table-column type="selection" fixed></el-table-column>
出现问题
如果您有任何想法,欢迎!
演示
开始
克隆到您的项目
git clone https://github.com/foolishchow/element-tree-grid.git
cd element-tree-grid
npm install # or yarn
npm run dev
与节点一起使用
npm install element-tree-grid --save
//common
var ElTreeGrid = require ( 'element-tree-grid' ) ;
Vue . component ( ElTreeGrid . name , ElTreeGrid ) ;
用途
常见用法
< el-table :data =" model.menus " border max-height =" 250 " >
< el-table-tree-column
file-icon =" icon icon-file "
folder-icon =" icon icon-folder "
prop =" label " label =" labelname " width =" 220 " > </ el-table-tree-column >
< el-table-column prop =" description " label =" description " width =" 180 " > </ el-table-column >
</ el-table >
从远程获取孩子
< div id =" app " style =" padding: 30px; " >
< el-table :data =" model.menus " border max-height =" 400 " >
< el-table-tree-column
:remote =" remote "
file-icon =" icon icon-file "
folder-icon =" icon icon-folder "
prop =" label " label =" MenuName " width =" 320 " > </ el-table-tree-column >
< el-table-column prop =" id " label =" id " width =" 180 " > </ el-table-column >
< el-table-column prop =" description " label =" Description " :show-overflow-tooltip =" true " width =" 180 " > </ el-table-column >
</ el-table >
</ div >
new Vue ( {
el : "#app" ,
data : {
model : {
menus : trees
}
} ,
methods : {
remote ( row , callback ) {
// async or sync are both supported
setTimeout ( function ( ) {
callback ( row . children )
} , 500 )
}
}
} )
属性
支持
el-table-column
的所有属性;
姓名 | 描述 | 价值观 |
---|---|---|
支柱 | 与el-table-column 相同 | |
标签 | 与el-table-column 相同 | |
宽度 | 与el-table-column 相同 | |
固定的 | 与el-table-column 相同 | |
可调整大小 | 与el-table-column 相同 | |
格式化程序 | 与el-table-column 相同 | |
类名 | 与el-table-column 相同 | |
树键 | 嵌套解析的关键 | 类型: String ,默认值: 'id' |
子数字键 | childNum 的键 | 类型: String ,默认值: 'child_num' |
父密钥 | Parent_id 的键 | 类型: String ,默认值: 'parent_id' |
级别键 | 节点深度的关键 | 类型: String ,默认值: 'depth' |
子键 | 节点子节点的键已放置 | 类型: String ,默认值: 'children' |
文件图标 | 文件图标类名 | 类型: String ,默认值: 'el-icon-file' |
文件夹图标 | 文件夹图标类名,打开时使用: folderIcon-open | 类型: String ,默认值: 'el-icon-folder' |
偏僻的 | 远程获取孩子的方法 | 类型: Function ,默认值: null |
所有远程 | 从远程请求所有数据,必须先配置remote 属性,默认使用请求缓存 | 类型: Boolean ,默认值: false |
展开全部 | 加载时展开所有节点 | 类型: Boolean ,默认值: false |
展开键 | key 告诉该行是否在 inited 处打开(仅消耗一次) | 类型: String ,默认值: expanded |
缩进大小 | 缩进数,单位px | 类型: Number ,默认值: 14 |
例子
< el-table-tree-column
file-icon =" icon icon-file "
folder-icon =" icon icon-folder "
prop =" label "
label =" labelname "
width =" 220 " > </ el-table-tree-column >
< el-table-tree-column
file-icon =" icon icon-file "
folder-icon =" icon icon-folder "
prop =" label "
label =" labelname "
:formatter =" formatter "
width =" 220 " > </ el-table-tree-column >
< el-table-tree-column
file-icon =" icon icon-file "
folder-icon =" icon icon-folder "
prop =" label "
label =" labelname "
width =" 220 " >
< template slot-scope =" scope " >
< span > prefix = > </ span >
< span > {{scope.row.label}} -- {{scope.row.id}} </ span >
< span > < = suffix </ span >
</ template >
</ el-table-tree-column >