Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Leaflet 删除属性不是一个函数_Leaflet - Fatal编程技术网

Leaflet 删除属性不是一个函数

Leaflet 删除属性不是一个函数,leaflet,Leaflet,大家好,我正在尝试删除传单地图上的传单徽标,但每当我尝试使用removeattribute删除徽标时,它会说这不是一个功能。我是这样做的L.removeattribute().addTo(map)。请告诉我我做得是否正确或有什么错误。使用L.Map的attributeioncontrol选项: 默认情况下是否将属性控件添加到地图 如果要在初始化映射后删除它,可以使用L.map的removeControl方法: 从映射中删除给定控件 属性控件实例存储为L.Map实例的属性attributeco

大家好,我正在尝试删除传单地图上的传单徽标,但每当我尝试使用
removeattribute
删除徽标时,它会说这不是一个功能。我是这样做的
L.removeattribute().addTo(map)
。请告诉我我做得是否正确或有什么错误。

使用
L.Map
attributeioncontrol
选项:

默认情况下是否将属性控件添加到地图

如果要在初始化映射后删除它,可以使用
L.map
removeControl
方法:

从映射中删除给定控件

属性控件实例存储为
L.Map
实例的属性
attributecontrol

var map = new L.Map('container');

map.removeControl(map.attributionControl);

您可以在初始化时执行此操作。试着这样做

L.Map('container', {
    'attributionControl': false
});

removeattribute
(注意大写字母“A”)不是
L
的静态函数,而是
L.Control.attribute的实例方法。因此,使用该方法的正确方法是首先获取地图的默认属性控件:

var map = L.map('map');
var control = map.attributionControl;
然后调用要删除的字符串,如:

control.removeAttribution('© OpenStreetMap');

如果使用
react传单
,可以通过将
attributecontrol={false}
附加到
Map
组件来删除属性:


绝对没问题,这就是我们在这里的目的,请记住,他是你最好的朋友:)
control.removeAttribution('© OpenStreetMap');