我是靠谱客的博主 繁荣诺言,这篇文章主要介绍记一次el-table需要序号但type=index设置无效,现在分享给大家,希望可以做个参考。

事情是这样的,有两个表格,其中一个需要显示序号,一个不需要。所以在el-table-column里做一个判断显示隐藏即可。但是使用了v-if后,序号无法显示
el-table有一个便捷的属性

复制代码
1
2
3
4
5
6
7
8
<el-table-column width="80" align="center" type="index" v-if="accountLevel.organizationLevel === 30" label="序号" > </el-table-column>

有v-if时候序号的索引会显示不出来,所以找了下答案,可以template去展示,以下为引用答案

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
<el-table max-height="290" :data="userTableData" border style="width: 100%"> <el-table-column label="序号"> <template slot-scope="scope"> {{scope.$index+1}} </template> </el-table-column> <el-table-column prop="user_nickname" label="用户昵称"> </el-table-column> <el-table-column prop="create_time" label="提交时间"> </el-table-column> </el-table>

引用答案的地址: https://blog.csdn.net/qq_39759115/article/details/82287352

最后

以上就是繁荣诺言最近收集整理的关于记一次el-table需要序号但type=index设置无效的全部内容,更多相关记一次el-table需要序号但type=index设置无效内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部