openlayers5更新后import问题(评论中解决)

openlayers5 的example中 所有示例不再导入ol.js  改为 

“`
       import Map from ‘ol/Map.js’;
      import View from ‘ol/View.js’;
      import TileLayer from ‘ol/layer/Tile.js’;
      import OSM from ‘ol/source/OSM.js’;
     const map = new Map({
        layers: [
          new TileLayer({
            source: new OSM()
          })
        ],
        target: ‘map’,
        view: new View({
          center: [0, 0],
          zoom: 2
        })
      });
“`
直接拷贝不能使用
是否延续使用旧的写法 引用5.0.0的ol.js
不采用新的写法
还是说新的写法有什么特殊用途

转载自:https://blog.csdn.net/qq_35505699/article/details/80858425

You may also like...