element ui table的使用备注

element ui table的使用备注

当给table设置了row-class-name时,选中的行高亮显示,但是当鼠标移入时(hover),会保持原有的hover,设置的会被覆盖,所以需要将原hover样式改变掉,但是由于table的hover属性是绑定在列td上的,所以需要在hover上增加td属性。

<el-table :data="data" border size="small" style="width: 100%" :row-class-name="tableRowClassName">
    <el-table-column width="70" align="center">
        <template #default="scope">
                    ...
        </template>
    </el-table-column>
</el-table>

const tableRowClassName = ({ row, rowIndex }) => {
    if (row.isShortList) {
       return 'shortList-row';
    }
     return '';
};

<style lang="less">
.el-table .shortList-row {
    background: #fcf6aa !important;
    &:hover > td {
        background: #fcf6aa !important;
    }
}
</style>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Element UI is a popular Vue.js UI library that provides a wide range of reusable and customizable UI components. One of these components is the table component, which allows developers to display data in a tabular format. To use the Element UI table component, you first need to install the Element UI library and import the necessary components in your project. Once you have done that, you can create a table by defining the columns and the data that you want to display. Here is an example of a basic Element UI table: ``` <template> <el-table :data="tableData"> <el-table-column prop="name" label="Name"></el-table-column> <el-table-column prop="age" label="Age"></el-table-column> <el-table-column prop="address" label="Address"></el-table-column> </el-table> </template> <script> export default { data() { return { tableData: [ { name: 'John', age: 35, address: '123 Main St' }, { name: 'Jane', age: 28, address: '456 Elm St' }, { name: 'Bob', age: 42, address: '789 Oak St' } ] } } } </script> ``` In this example, we define a table with three columns: Name, Age, and Address. We also define an array of objects that represent the data that we want to display in the table. The `prop` attribute of each column specifies the key in the data object that corresponds to that column. There are many customization options available for the Element UI table component, such as sorting, filtering, pagination, and row selection. You can also use slots to customize the appearance of the table or add custom functionality.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值