@@ -349,24 +349,14 @@ export default {
return {
// 自定义属性,也就是官方文档中的props,可通过条件来控制样式
style: {
- // 设置字体颜色
- // 'color': record.id === this.leftAlignId ? '#fff' : '',
// 设置行背景色
- 'background-color': record.id === this.leftAlignId ? '#fff1c5' : ''
- // 设置字体类型
- // 'font-family': 'Microsoft YaHei',
- // // 下划线
- // 'text-decoration': 'underline',
- // // 字体样式-斜体
- // 'font-style': 'italic',
- // // 字体加粗
- // 'font-weight': 'bold'
+ 'background-color': record[this.rowKeyName] === this.leftAlignId ? '#fff1c5' : ''
},
on: {
// 鼠标单击行
click: event => {
// 记录当前点击的行标识
- this.leftAlignId = record.id
+ this.leftAlignId = record[this.rowKeyName]
}
@@ -165,7 +165,8 @@
ref="table"
:style="{ height: tableHeight+70+'px' }"
size="small"
- :rowKey="(record) => record.id"
+ rowKeyName="no"
+ :rowKey="(record) => record.no"
:columns="columns"
:data="loadData"
:scroll="{ y: tableHeight,x:2250 }"