iview,table組件怎么用代碼設置當前選中行
iview,table組件怎么用代碼設置當前選中行
慕田峪4524236
2018-08-10 20:51:43
TA貢獻1831條經驗 獲得超9個贊
1.鼠標點擊選中
Table props:
highlight-row 是否支持高亮選中的行,即單選 Boolean false;
<Table highlight-row :columns="columns" :data="data1"></Table>
2.指定某行,或多行顯示
Table props:
row-class-name 行的 className 的回調方法,傳入參數:row:當前行數據index:當前行的索引 Function -
<Table :row-class-name="rowClassName" :columns="columns" :data="data"></Table>
methods: { rowClassName (row, index) { if (index === 1) { return 'demo-table-info-row'; // 樣式名 } else if (index === 3) { return 'demo-table-error-row'; // 樣式名 } return ''; } }
舉報