elememt-ui文档中没有合计行点击事件
function handleTableRendered() {
nextTick(() => {
const table = document.querySelector('.el-table__footer-wrapper>table')
if (table) {
table.rows[0].cells[4].onclick = () => {
boundType.value = boundEnum.INBOUND.V
boundSummaryVisible.value = true
}
table.rows[0].cells[5].onclick = () => {
boundType.value = boundEnum.OUTBOUND.V
boundSummaryVisible.value = true
}
}
})
}
获取dom节点,我是给第四和第五的合计添加点击事件,所以取的是table.rows[0].cells[4],table.rows[0].cells[5],根据需求取。
最后在onMounted调用handleTableRendered函数即可。
样式修改:
::v-deep(.el-table__footer) {
cursor: pointer;
.cell {
color: #0d84ff;
}
}