我正在尝试使用动态 Url 处理实现一个 react-leaflet 地图,代码如下:
// some code here ///
const sideBySideMap = L.control.splitMap(
L.tileLayer(tiles[leftTileIndex]._url, {
tms: true,
opacity: 1,
attribution: "",
minZoom: 1,
maxZoom: 16,
}),
L.tileLayer(tiles[rightTileIndex]._url, 'padding: 50;' , {
tms: true,
opacity: 1,
attribution: "",
minZoom: 1,
maxZoom: 16,
})
);
useEffect(() => {
if (map) {
sideBySideMap.addTo(map);
}
}, [map]);
这种和平正在生成分割地图的实例,我正在尝试在使用效果中将分割地图图层添加到地图中,但出现错误 ->“类型错误:无法读取未定义的属性'样式'” . Screen Shot Of Error。