【问题标题】:Vuetable-2 field formatter not working as intendedVuetable-2 字段格式化程序未按预期工作
【发布时间】:2022-09-29 17:30:36
【问题描述】:

我正在使用 vuetable-2 并且不知何故我的字段的格式化程序不起作用。我的isCoach 字段的前端仍显示为1,但根据格式化程序集,它应该返回Active

模板

<vuetable
  ref=\"vuetable\"
  api-url=\"\"
  :query-params=\"makeQueryParams\"
  :per-page=\"perPage\"
  pagination-path
  data-path=\"Data\"
  :reactive-api-url=\"true\"
  :fields=\"fields\"
  :row-class=\"onRowClass\"
  @vuetable:pagination-data=\"onPaginationData\"
  @vuetable:cell-rightclicked=\"rightClicked\"
>

数据

fields:[
{
          name: \"isCoach\",
          sortField: \"isCoach\",
          title: \"Coach\",
          titleClass: \"\",
          dataClass: \"text-muted\",
          width: \"5%\",
          formatter: (value) => {
            return value === \'1\' ? \'Active\' : \'Disable\'
          }
        },
]

文档:https://www.vuetable.com/guide/fields-definition.html#field-options

    标签: vue.js vue-tables-2


    【解决方案1】:

    我找到了解决方案。显然formatter 不起作用。将其更改为 callback 解决了我的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-13
      • 1970-01-01
      • 2018-03-21
      • 2019-09-11
      相关资源
      最近更新 更多