zollero / el-search-table-pagination

🐶 Combine Form, Table and Pagination components of Element UI together.
MIT License
305 stars 79 forks source link

column上的formatter有成功使用过的例子吗? #29

Closed pzgz closed 5 years ago

pzgz commented 5 years ago

我在项目里面弄了很久,一直不起作用,刚刚用你的sample也测试了一下,也是不起作用:

https://codepen.io/anon/pen/yRVbKB

有没有能成功使用的代码示例吗?

zollero commented 5 years ago

@pzgz 请使用column的 render 函数,render 函数有一个参数,是当前行数据的对象。

image

pzgz commented 5 years ago

嗯,我注意到render这个函数了,本来还是想继续尝试用原有的formatter,主要是有点强迫症,想弄清楚为什么,直接看源代码,也没发现有啥问题

zollero commented 5 years ago

@pzgz 有可能是 el-search 使用了内嵌slot的方式,覆盖了 formatter 解析的数值

pzgz commented 5 years ago

@zollero 明白了,非常感谢提醒,的确是你说的,这么看来的话,其实col上render和formatter是基本一致的作用,不过我还是做了一点修改,如果定义了formatter并且没有定义render的话,会使用formatter,想法主要有两个:

不过是否合并,还看你的决定,我等会儿submit一个PR,谢谢

zollero commented 5 years ago

Good job!