format[treeTable]: format code

This commit is contained in:
Pan 2018-01-23 15:03:09 +08:00
parent fea6e5feee
commit 3253a91a7e
5 changed files with 100 additions and 103 deletions

View File

@ -2,23 +2,18 @@
<el-table :data="formatData" :row-style="showRow">
<el-table-column v-if="columns.length===0" width="150">
<template slot-scope="scope">
<span v-for="space in scope.row._level"
class="ms-tree-space"></span>
<span class="tree-ctrl" v-if="iconShow(0,scope.row)"
@click="toggleExpanded(scope.$index)">
<span v-for="space in scope.row._level" class="ms-tree-space" :key="space"></span>
<span class="tree-ctrl" v-if="iconShow(0,scope.row)" @click="toggleExpanded(scope.$index)">
<i v-if="!scope.row._expanded" class="el-icon-plus"></i>
<i v-else class="el-icon-minus"></i>
</span>
{{scope.$index}}
</template>
</el-table-column>
<el-table-column v-else v-for="(column, index) in columns" :key="column.value"
:label="column.text" :width="column.width">
<el-table-column v-else v-for="(column, index) in columns" :key="column.value" :label="column.text" :width="column.width">
<template slot-scope="scope">
<span v-if="index === 0" v-for="space in scope.row._level"
class="ms-tree-space"></span>
<span class="tree-ctrl" v-if="iconShow(index,scope.row)"
@click="toggleExpanded(scope.$index)">
<span v-if="index === 0" v-for="space in scope.row._level" class="ms-tree-space" :key="space"></span>
<span class="tree-ctrl" v-if="iconShow(index,scope.row)" @click="toggleExpanded(scope.$index)">
<i v-if="!scope.row._expanded" class="el-icon-plus"></i>
<i v-else class="el-icon-minus"></i>
</span>

View File

@ -1,8 +1,9 @@
## 写在前面
此组件仅提供一个创建TreeTable的解决方案
##prop说明
###data
必输
**必填**
原始数据,要求是一个数组或者对象
```javascript
@ -11,10 +12,12 @@
key2: value2,
children: [{
key1: value1
},{
},
{
key1: value1
}]
},{
},
{
key1: value1
}]
```
@ -25,7 +28,8 @@
key2: value2,
children: [{
key1: value1
},{
},
{
key1: value1
}]
}
@ -66,6 +70,7 @@
**请注意自定义的解析函数参数第一个为this.data你不需要在evalArgs填写。**
如你的解析函数需要的参数为`(this.data,1,2,3,4)`,那么你只需要将`[1,2,3,4]`赋值给`evalArgs`就可以了
## slot
请参考`customTreeTable`

View File

@ -151,9 +151,9 @@ export const asyncRouterMap = [
{ path: 'dynamic-table', component: _import('example/table/dynamicTable/index'), name: 'dynamicTable', meta: { title: 'dynamicTable' }},
{ path: 'drag-table', component: _import('example/table/dragTable'), name: 'dragTable', meta: { title: 'dragTable' }},
{ path: 'inline-edit-table', component: _import('example/table/inlineEditTable'), name: 'inlineEditTable', meta: { title: 'inlineEditTable' }},
{ path: 'complex-table', component: _import('example/table/complexTable'), name: 'complexTable', meta: { title: 'complexTable' }},
{ path: 'treeTable', component: _import('example/table/treeTable/treeTable'), name: 'treeTable', meta: { title: 'treeTable' }},
{ path: 'customTreeTable', component: _import('example/table/treeTable/customTreeTable'), name: 'customTreeTable', meta: { title: 'customTreeTable' }}
{ path: 'tree-table', component: _import('example/table/treeTable/treeTable'), name: 'treeTable', meta: { title: 'treeTable' }},
{ path: 'custom-tree-table', component: _import('example/table/treeTable/customTreeTable'), name: 'customTreeTable', meta: { title: 'customTreeTable' }},
{ path: 'complex-table', component: _import('example/table/complexTable'), name: 'complexTable', meta: { title: 'complexTable' }}
]
},
{ path: 'tab/index', icon: 'tab', component: _import('example/tab/index'), name: 'tab', meta: { title: 'tab' }}

View File

@ -34,6 +34,7 @@
*/
import treeTable from '@/components/TreeTable'
import treeToArray from './customEval'
export default {
name: 'tree',
components: { treeTable },
@ -125,7 +126,3 @@ export default {
}
}
</script>
<style scoped>
</style>

View File

@ -1,6 +1,5 @@
<template>
<tree-table :data="data" :columns="columns">
</tree-table>
<tree-table :data="data" :columns="columns"></tree-table>
</template>
<script>
@ -9,6 +8,7 @@
Created: 2018/1/19-14:54
*/
import treeTable from '@/components/TreeTable'
export default {
name: 'tree',
components: { treeTable },