Ant-design-vue: 如何在template slot-scope中使用数据行的index??

Created on 31 May 2019  ·  9Comments  ·  Source: vueComponent/ant-design-vue

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.1.7

Environment

the latest

Reproduction link

https://github.com/vueComponent/ant-design-vue/issues/new/choose

Steps to reproduce

xxx

What is expected?

当为在template这样获取table组件中数据的下标时,输出的数据的item。
如何才能如何才能简单快捷的拿到index
在官网没找到我要的答案!!!

What is actually happening?

当为在template这样获取table组件中数据的下标时,输出的数据的item。

Most helpful comment

action="text, record, index"

All 9 comments

image

@wangxueliang ,这个index显示的是数据的索引,比如在第二页的时候,那么第一行的数据还是1 ,不是真实的行号,有什么办法显示真实的行号吗? 觉得slot-scope中是否有一个页码的参数就好了。。。

这种可以考虑预处理数据data

(currentPage * pageSzie) + index

image

谢谢回复

还有个疑问,当我用了这个方案,并且Table传入dataSource为列表,比如[{...}, {....}],发现text和record的值是一样的,为{...}。那么text和record的设计初衷是什么?

请问表格中的 slot="action" slot-scope="text, record"v-slot 该如何写呢?

我尝试改成 v-slot:action=text, record ,结果编译报错。如下:

image

action="text, record, index"

@iiDestiny 请问这个text,record, index分别代表啥意思呀,文档都没看见

image

谢谢回复

还有个疑问,当我用了这个方案,并且Table传入dataSource为列表,比如[{...}, {....}],发现text和record的值是一样的,为{...}。那么text和record的设计初衷是什么?

我现在正好用到,我也纳闷,为什么text, record, index 时,前两个参数值一样。

Was this page helpful?
0 / 5 - 0 ratings