当使用element-ui 的el-table时,只要在中满足一下两个条件时,表格列动态展示时会出现排序错乱
条件一:el-table-column中使用template slot-scope=“scope”
比如:
<el-table-column>
<template slot-scope="scope">
{{scope.row.name}}
</template>
</el-table-column>
条件二:el-table-column中使用 template slot-scope=“scope” v-if="…" 出现v-if 选择性展示
<el-table-column label="销量" v-if="listState==1" >
<template slot-scope="scope">
{{scope.row.name}}
</template>
</el-table-column>
解决方法
给每个 el-table-column 加一个key值,【注意】是每一个el-table-column,可以用数字的方式给key赋值