PS:写之前衡量了一下自己写的工作量,最后还是屈服于element了!
(主要是能力不足+有一颗偷懒的心)
搜索后改变对应行样式:
1、搭建树状表:
两行核心代码:
:expand-row-keys="expands"
:row-style="tableRowClass"
<template>
<el-input v-model="input"></el-input> // 搜索框
<el-table
:data="dataList"
height="866"
row-key="id" //每一行的唯一识别属性
indent="20"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
:expand-row-keys="expands" //展开对应节点(自带)
:row-style="tableRowClass"> //遍历每一行,改变行样式的函数(自带)
<el-table-column prop="id" label="ID" width="120px"/>
<el-table-column prop="xx" label="X