forked from ElemeFE/element
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Table:Fix hides the child nodes of the tree when new nodes are added …
…[issues ElemeFE#14933]
- Loading branch information
ax
committed
Apr 3, 2019
1 parent
0cbb226
commit 8420952
Showing
3 changed files
with
135 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,99 @@ | ||
<template> | ||
<div style="margin: 20px;"> | ||
<el-input v-model="input" placeholder="请输入内容"></el-input> | ||
<el-button @click="handleAddRow">添加</el-button> | ||
<el-table | ||
:data="list" | ||
row-key="id" | ||
highlight-current-row | ||
@current-change="handleCurrentChange" | ||
:expand-row-keys="expanded" | ||
lazy | ||
:load="loadApplication" | ||
ref="table" | ||
> | ||
<el-table-column | ||
type="index" | ||
width="50"> | ||
</el-table-column> | ||
<el-table-column | ||
prop="name" | ||
label="名称" | ||
width="180"> | ||
</el-table-column> | ||
<el-table-column | ||
prop="code" | ||
label="标识" | ||
width="180"> | ||
</el-table-column> | ||
<el-table-column | ||
label="Home" | ||
width="360"> | ||
<template slot-scope="scope"> | ||
<a :href="scope.row.home">{{ scope.row.home }}</a> | ||
</template> | ||
</el-table-column> | ||
<el-table-column | ||
prop="repos" | ||
min-width="200" | ||
label="代码仓库"> | ||
</el-table-column> | ||
<el-table-column | ||
fixed="right" | ||
label="操作" | ||
width="100"> | ||
<template slot-scope="scope"> | ||
<el-button @click="handleEdit(scope.row)" type="text" size="small">编辑</el-button> | ||
<el-button @click="handleDelete(scope.row)" type="text" size="small">删除</el-button> | ||
</template> | ||
</el-table-column> | ||
</el-table> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
let id = 100; | ||
export default { | ||
data() { | ||
return { | ||
input: 'Hello Element UI!' | ||
expanded: [1], | ||
list: [{ | ||
id: 1, | ||
hasChildren: true, | ||
name: '测试'+1, | ||
children: [{ | ||
id: 2, | ||
hasChildren: true, | ||
name: '测试'+2 | ||
}] | ||
}] | ||
}; | ||
}, | ||
methods:{ | ||
loadApplication(data, node, resolve){ | ||
id++; | ||
resolve([{ | ||
id: id, | ||
hasChildren: true, | ||
name: '测试'+id | ||
}]); | ||
}, | ||
handleAddRow(){ | ||
id++; | ||
this.list.push({ | ||
id: id, | ||
hasChildren: true, | ||
name: '测试'+id | ||
}); | ||
}, | ||
handleCurrentChange(){ | ||
}, | ||
handleEdit(){ | ||
}, | ||
handleDelete(){ | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters