ArcGIS JS TypeScript Popup FieldInfo设置 format 四舍五入无效

通过TypeScript写ArcGIS JS的代码,简单封装了一下图层展示相关的,发现在PopupTemplate中配置FieldInfo format:{places:2}无效,
feature.popupTemplate = new PopupTemplate({
title: "{湖泊名称}",
content: [
{
type: "fields",
fieldInfos: [
new FieldInfo({
label: "湖泊等级",
fieldName: "湖泊等级"
}),
new FieldInfo({
label: "所属行政区",
fieldName: "所属行政区"
}),
new FieldInfo({
label: "水域面积(km²)",
fieldName: "水域面积",
format:new FieldInfoFormat({
places: 2
})
}),
new FieldInfo({
label: "湖岸线长度(km)",
fieldName: "湖岸线长度",
format:new FieldInfoFormat({
places: 2
})
})
]
}
]
});

而通过如下方式,可以正常四舍五入。
 feature.popupTemplate = new PopupTemplate({
title: "{湖泊名称}",
content:
"<table class='popupTable'>" +
"<tr><td>湖泊名称</td><td> {湖泊名称}</td></tr>" +
"<tr><td>湖泊等级</td><td> {湖泊等级}</td></tr>" +
"<tr><td>所属行政区</td><td> {所属行政区}</td></tr>" +
"<tr><td>水域面积(km²)</td><td> {水域面积:NumberFormat(places:3)}</td></tr>" +
"<tr><td>湖岸线长度(km)</td><td> {湖岸线长度:NumberFormat(places:3)}</td></tr>" +
"</table>"
});
是否有大神遇到过类似的问题?该如何解决
已邀请:

许丹石

赞同来自:

保留小数位数.png
                {
fieldName: "B12001_calc_numMarriedE",
label: "People Married",
format: {
digitSeparator: true,
places: 1
}
},
测试这么写可以起作用。

要回复问题请先登录注册