@row-click=“rowClick” 当某一行被点击时会触发该事件
@current-change=“handleCurrentChange” 选中改变是触发
:row-class-name=“tableRowClassName” 可以通过指定 Table 组件的 row-class-name 属性来为 Table 中的某一行添加 class,表明该行处于某种状态。
:row-style=“rowClass” //设置这一行的样式
方法如下:
handleCurrentChange(val) { this.currentRow = val; this.selectedIndex=val.index; console.log(this.currentRow) }, rowClass({row, rowIndex}){ if((this.selectedIndex) === rowIndex){ // return { "background-color": "rgba(185, 221, 249, 0.75)" } return { "border": "solid 1px #3dffef","background-color": "rgba(185, 221, 249, 0.75)" } } }, /把每一行的索引放进row tableRowClassName({row, rowIndex}){ row.index=rowIndex; }