小编xha*_*car的帖子

为什么示例不起作用?(与进口斗争)

在页面https://openlayers.org/en/latest/examples/image-vector-layer.html我将HTML代码从地图下复制到/tmp/a.html并运行firefox /tmp/a.html.

最初有两个问题很容易解决:

  1. SyntaxError:import声明只能出现在模块的顶层
  2. 未声明HTML文档的字符编码.文件......

要解决这个问题:

  1. 替换<script><script type="module">
  2. 添加<meta charset="UTF-8"><head></head>

但是第三个错误怎么办?

TypeError: Error resolving module specifier: ol/Map.js

我有Firefox 60.0.1.

那么,示例中的HTML代码是否可以像我一样使用,或者我误解了什么?

我的代码需要import Map from ol/Map.js什么?

(我试图重新提出问题,但如果我仍然应该得到负面排名,请解释原因.谢谢)

openlayers

16
推荐指数
2
解决办法
9809
查看次数

标签 统计

openlayers ×1