elementui table表格 点击行实现高亮

    科技2024-11-05  9

    记得要将 highlight-current-row 高亮属性打开

    <template> <el-table highlight-current-row :data="table1" :row-style="{height: '20px'}" :header-cell-style="{background:'#e6e6e6',color:'#000000'}" border style="width: 30%;"> <el-table-column prop="date" label="选择一级分类" width="125"> </el-table-column> </el-table> </template>

    利用css改变选择的行背景颜色,字体颜色…

    <style> /* 设置当前页面elementui table 选中行时的背景色*/ .el-table__body tr.current-row>td{ background-color: #ebf0f1 !important; color: #000000; font-weight: 700; } </style>
    Processed: 0.015, SQL: 8