«

Element ui中 el-table同时使用 type=“selection“ 和type=“index“时,设置序号的不显示了

yang 发布于 阅读:439 项目


项目中使用element ui 中el-table的多选项及序号时发现序号不显示了,单独设置一个可以显示

例如只设置序号或者只设置多选项可以正常显示

//只设置多选项列时可以正常显示
<el-table>
   <el-table-column type="selection" width="50"></el-table-column>
......
<el-table>

// 只设置序号列时也可以正常显示
<el-table>
   <el-table-column lable="序号" type="index" width="50"></el-table-column>
......
<el-table>

同时设置选择项跟序号时页面不显示序号

<el-table>
   <el-table-column type="selection" width="50"></el-table-column>
   <el-table-column lable="序号" type="index" width="50"></el-table-column>
......
<el-table>

修改代码如下

<el-table>
   <el-table-column type="selection" width="50"></el-table-column>
   <el-table-column lable="序号" type="index" width="50">
     <template slot-scope="scope">
        {{ scope.$index+1 }}
     </template>
   </el-table-column>
......
<el-table>

版权所有:微4e
文章标题:Element ui中 el-table同时使用 type=“selection“ 和type=“index“时,设置序号的不显示了
除非注明,文章均为 微4e 原创,请勿用于任何商业用途,禁止转载

推荐阅读:


扫描二维码,在手机上阅读
请先 登录 再评论