'subLayers' of undefined

0 投票

function layerService() {
    L.supermap
        .layerInfoService(url,{
            proxy: "http://localhost:8090/GettingStart/httpproxy/httpproxy.jsp?url=http://222.84.136.150:8081/geoesb/proxy/f6b3c78a553843919b45ca9d0be09cc2/886e60bb7e014f22a707de23e6f6505d",
            crossOrigin: true,
        })
        .getLayersInfo(function (serviceResult) {
            var result = serviceResult.result;
            var innerHTML = "";
            result.subLayers.layers.map(function (layer) {
                innerHTML += layer.name + "<br>";
            });
            infowin = L.popup({maxWidth: 400})
                .setLatLng(map.getCenter())
                .setContent(innerHTML)
                .openOn(map);
        });
}

量距量面.html:82 Uncaught (in promise) TypeError: Cannot read property 'subLayers' of undefined
    at Bs.<anonymous> (量距量面.html:82)
    at Ie.triggerEvent (iclient-leaflet-es6.min.js:101)
    at Bs.serviceProcessFailed (iclient-leaflet-es6.min.js:218)
    at Bs.getUrlFailed (iclient-leaflet-es6.min.js:218)
    at iclient-leaflet-es6.min.js:28
    at iclient-leaflet-es6.min.js:218

这个错误怎么解决 代码在iserver10上运行的

10月 27, 2020 分类:  122次浏览 | 用户: 木大木大 初出茅庐 (43 分)

1个回答

0 投票
把serviceResult给console.log出来看一下这个参数,里面的type是成功还是失败。如果是失败,那么检查你的url问题
10月 27, 2020 用户: 李俊霖 名扬四海 (1,625 分)
...