Giter Site home page Giter Site logo

Comments (5)

pzgz avatar pzgz commented on May 27, 2024 1

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

  • 尽量和el-table的定义保持一致
  • 也是比较关键的一点,formatter的参数内带了cellValue,所以在同一个表格呢如果有多个字段需要做同样的格式化时,如果使用render就需要写不同的函数去处理各自的prop,用formatter的话就可以共用

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

from el-search-table-pagination.

zollero avatar zollero commented on May 27, 2024

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

image

from el-search-table-pagination.

pzgz avatar pzgz commented on May 27, 2024

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

from el-search-table-pagination.

zollero avatar zollero commented on May 27, 2024

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

from el-search-table-pagination.

zollero avatar zollero commented on May 27, 2024

Good job!

from el-search-table-pagination.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.