4.8 遍历 FeatureLayer 出错
只是将引用版本由4.7变成4.8,就无法便利FeatureLayer要素。代码如下:
view.whenLayerView(featureLayer).then(function (lyrView) {
lyrView.watch("updating", function (val) {
if (!val) {
lyrView.queryFeatures().then(function (results) {
//results 值正常,只是Feature的Field个数减少了,下一句forEach报错
results.forEach(function (result, index) {
let attributes = result.attributes;
let name = attributes.STNM;
}
};
}
}
};
view.whenLayerView(featureLayer).then(function (lyrView) {
lyrView.watch("updating", function (val) {
if (!val) {
lyrView.queryFeatures().then(function (results) {
//results 值正常,只是Feature的Field个数减少了,下一句forEach报错
results.forEach(function (result, index) {
let attributes = result.attributes;
let name = attributes.STNM;
}
};
}
}
};
0 个回复