Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/432.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
Javascript 传单JS中的标记由于错误\u无效\u URL错误而无法正确加载_Javascript_Vuejs2_Leaflet - Fatal编程技术网

Javascript 传单JS中的标记由于错误\u无效\u URL错误而无法正确加载

Javascript 传单JS中的标记由于错误\u无效\u URL错误而无法正确加载,javascript,vuejs2,leaflet,Javascript,Vuejs2,Leaflet,我试图在我的传单地图上添加标记,但它们没有出现 在控制台中,我看到一个网络错误:net::ERR_无效\u加载图像的http请求URL如下: Request URL: data:image/png;base64,iVBORw0KGgoAA.....SUVORK5CYII=")marker-icon-2x.png 如果我删除URL的最后一部分 )marker-icon-2x.png 我最终得到了一个正确的base64编码图像。所以我想问题是在URL的末尾添加了什么标记图标 更多背景: 我的代

我试图在我的传单地图上添加标记,但它们没有出现

在控制台中,我看到一个网络错误:net::ERR_无效\u加载图像的http请求URL如下:

Request URL: data:image/png;base64,iVBORw0KGgoAA.....SUVORK5CYII=")marker-icon-2x.png
如果我删除URL的最后一部分

)marker-icon-2x.png
我最终得到了一个正确的base64编码图像。所以我想问题是在URL的末尾添加了什么标记图标

更多背景:

  • 我的代码如下所示:
  • 我的地图渲染正确,我可以在上面画多边形等等

  • 我用的是Vue和VUE2传单

  • 我已经导入了传单。css

  • 我已尝试包含这些代码行,但没有效果:


为l-marker的“icon”属性提供一些默认值,如下所示,为我解决了这个问题。不过,它始终需要一个默认的有效图像路径,这意味着我们必须至少有一个图像或其有效URL可用。 顺便说一句,下面提到的L对象是从“传单”包中导入的

defaultIcon = L.icon({
        iconUrl: require('../assets/logo.png'),
        shadowUrl: require('../assets/logo.png'),
    });
这项工作:

从“传单”导入L;
删除L.Icon.Default.prototype.\u getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl:require('slipal/dist/images/marker-icon-2x.png')。默认值,
iconUrl:require('传单/dist/images/marker-icon.png')。默认值,
shadowUrl:require('slipal/dist/images/marker shadow.png')。默认值,
});

如果您能解决此问题,我们将非常感谢您的解决方案!有关根本原因和几种可能的解决方案,请参阅
delete Icon.Default.prototype._getIconUrl

Icon.Default.mergeOptions({
  iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
  iconUrl: require('leaflet/dist/images/marker-icon.png'),
  shadowUrl: require('leaflet/dist/images/marker-shadow.png')
});
defaultIcon = L.icon({
        iconUrl: require('../assets/logo.png'),
        shadowUrl: require('../assets/logo.png'),
    });