1.表头与内容错位:
//全局设置
.el-table--scrollable-y .el-table__body-wrapper {
overflow-y: overlay !important;
}
2.表格跨分页多选勾选:
//根据文档,只需加上row-key和reserve-selection即可。
<el-table row-key="id">
<el-table-column type="selection" reserve-selection></el-table-column>
</el-table>
3.table内嵌input调用focus方法无效:
<el-table>
<el-table-column label="名称">
<template>
<el-input ref="inputRef" />
</template>
</el-table-column>
</el-table>
// 无效
this.$refs['inputRef'].focus()
this.$refs['inputRef'][0].focus()
this.$refs['inputRef'].$el.children[0].focus()
// 有效
<el-input id="inputRef" />
document.getElementById('inputRef').focus()
- el-tree展开/收起所有节点:
<el-tree ref="tree"></el-tree>
expandTree(expand = true) {
const nodes = this.$refs['tree'].store._getAllNodes()
nodes.forEach(node => {
node.expanded = expand
})
}