element-ui 表格列動態展示,排序錯亂問題
阿新 • • 發佈:2018-12-21
<el-table :data="tableData" border stripe style="width: 100%;background:white;" > <el-table-column key="1" type="index" label="序號" align="center" width="80" :resizable='false'></el-table-column> <el-table-column key="2" prop="orgName" label="單位" align="center" :resizable='false'></el-table-column> <el-table-column key="3" prop="personName" label="姓名" align="center" :resizable='false'></el-table-column> <el-table-column key="4" v-if="staticsTmp.ruleAttendanceDuration" prop="ruleAttendanceDuration" label="外勤(小時)" align="center" :resizable='false'></el-table-column> <el-table-column key="5" v-if="staticsTmp.innerDutyDuration" prop="innerDutyDuration" label="內勤(小時)" align="center" :resizable='false'></el-table-column> <el-table-column key="6" v-if="staticsTmp.leaveCount" prop="leaveCount" label="請假(小時)" align="center" :resizable='false'></el-table-column> <el-table-column key="7" v-if="staticsTmp.changeCount" prop="changeCount" label="調休(小時)" align="center" :resizable='false'></el-table-column> <el-table-column key="8" v-if="staticsTmp.lendCount" prop="lendCount" label="借出(小時)" align="center" :resizable='false'></el-table-column> </el-table>
加上key='1' 可以保證在動態展示時,列的順序不變化。