0

我对不同的 API 使用相同的 Ext Js 模型。但在某些 API 中,我会将字段设为“SupplierID”,而在某些 API 的响应中,我会将其设为“supplierId”。

我正在寻找在 Ext JS 框架中映射时忽略大小写的选项。

fields:
  [
    { name: 'SupplierID', type: 'int', mapping: 'supplierId' },
  ]

请告知 Ext Js 中是否有任何选项可以在提交名称映射时忽略大小写。这样我就可以避免创建多个模型。

4

1 回答 1

0

您可以使用计算:

fields: [
    { name: 'SupplierID', type: 'int',
        calculate: function (data) {
            return data.SupplierID || data.supplierId;
        }
    },
]
于 2018-11-28T15:07:05.977 回答