1.在表格中某列返回的是0,1,可通過formmatter進(jìn)行轉(zhuǎn)換文字展示
template中:
<el-table-column
? ? prop="status"
? ? label="有效狀態(tài)"
? ? :formatter="statusFormate"
></el-table-column>
methods中定義
? ? statusFormate(row, index) {
? ? ? if (row.status == "1") {
? ? ? ? return "生效中";
? ? ? } else if (row.status == "0") {
? ? ? ? return "已失效";
? ? ? } else {
? ? ? ? return "";
? ? ? }
? ? },
2.給table-column-item加上fixed屬性可將某列固定在某個(gè)位置
<el-table-column
? ? ? ? fixed="right"
? ? ? >
</el-table-column>
3.在table中獲取某一行數(shù)據(jù)進(jìn)行操作
<el-table-column
? ? ? ? label="操作"
? ? ? >
? ? <template slot-scope="scope">
? ? ? ? <el-button
? ? ? ? @click="handleDetail(scope.$index, scope.row)"
? ? ? ? >詳情</el-button>
? ? </template>
</el-table-column>