我正在使用mapbox,我想从本地设备在地图上添加一个自定义图标。我正在使用一个例子:https://docs.mapbox.com/mapbox-gl-js/example/custom-marker-icons/,但我想从我的设备或项目文件夹中选择图像或图标供使用。就像。
var el = document.createElement('div');
el.className = 'marker';
el.style.backgroundImage ='../images/icon.png';
el.style.width = 29 + 'px';
el.style.height = 29 + 'px';但这不管用。工作路线是。url(https://docs.mapbox.com/mapbox-gl-js/assets/cat.png);
发布于 2022-08-28 02:01:49
在您提供的代码片段中,您正在设置一个背景图像样式属性,这意味着‘../
如果
出现问题
https://stackoverflow.com/questions/68958486
复制相似问题