问题描述:el-table中使用type=index来显示序号。发现有时候序号不能正常显示,一开始写法如下,官网上的写法 <el-table-column type="index" width="50"> </el-table-column> 分析:经百度,可能因为el-table这块使用v-if控制显示导致,的确代码中那一部分使用了v-if。 问题解决:type=index换一种写法: <el-table-column label="序号" type="index" width="80" align="center" > <template slot-scope="scope"> {{ scope.$index+1 }} </template> </el-table-column> 这种写法是可以的,记录一下。 |
|