We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
element-ui的表格组件提供了type="expand"来展开行,但是方式和样式可能不是我们所需要的。
element-ui
type="expand"
可能我们需要点一个按钮或者一段文字来做到展开
ref
>
row
table
element-ui table
toggleRowExpansion
html:
<el-table ref="table" :data="list" element-loading-text="Loading" border > <el-table-column label="操作" align="center" width="200px" > <template slot-scope="scope"> <el-button type="text" size="mini" @click="detailClick(scope.row)" >查看详情</el-button> <el-divider direction="vertical" <el-button type="text" size="mini" @click="reviseClick(scope.row.id)" >编辑</el-button> <el-divider direction="vertical" <el-button type="text" size="mini" @click="deleteClick(scope.row.id)" >删除</el-button> </template> </el-table-column> <el-table-column type="expand" width="1" > <template slot-scope="scope"> {{ scope.row }} </template> </el-table-column> </el-table>
js:
export default { methods: { detailClick(row) { const table = this.$refs.table table.toggleRowExpansion(row) } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
背景
element-ui
的表格组件提供了type="expand"
来展开行,但是方式和样式可能不是我们所需要的。可能我们需要点一个按钮或者一段文字来做到展开
思路
ref
type="expand"
来展开行,但是宽度设为1,为了不显示出来 注意,这一列必须放在最后一列,否则会在它右侧那一列显示出来>
箭头row
信息,通过ref
来获取table
,使用element-ui table
提供的toggleRowExpansion
方法,把row
传递进去,就可以通过自定义的样式,来开展行了。因为使用了toggleRowExpansion
,就可以触发对应行的type="expand"
列,来实现展开代码
html:
js:
The text was updated successfully, but these errors were encountered: