首页 > 解决方案 > 使用 antd column render 显示另一列的百分比

问题描述

我忽略的另一个可能很简单的问题。在我的专栏中:

    {
      title: 'Min. Value',
      dataIndex: 'min_value',
      render: min_value => `${min_value}`,
      width: '10',
    },
    {
      title: 'Max Value',
      dataIndex: 'max_value',
      render: max_value => `${max_value}`,
      width: '15',
    },
    {
      title: 'Min. Commission',
      dataIndex: 'min_commission',
      render: row => {row.min_value},
      width: '15',
    },
    {
      title: 'Max Commission',
      dataIndex: 'max_commission',
      render: max_value => `${max_value}`,
      width: '15',
    },

我正在尝试使用该render选项min_commissionmax_commission显示它们各自的最小值/最大值列的百分比。当前min_commission显示的只是尝试显示来自min_value.

这只是给出了错误:

Failed to compile
./src/components/LeaderBoard.js
  Line 65:23:  Expected an assignment or function call and instead saw an expression  no-unused-expressions

Search for the keywords to learn more about each error.

只是试图显示另一列中的数据,我有点卡住了。我觉得这是我在担心添加百分比计算之前需要的第一步,我只是不知道如何提取数据。当前row => {row.min_value}是基于我发现的另一个几乎类似情况的线程,所以我认为它可能会起作用。

标签: javascriptreactjsantd

解决方案


推荐阅读