NodeJS 環境安裝包下載:https://nodejs.org/zh-cn/download/
安裝vue-cli3.0.1: https://cli.vuejs.org/guide/installation.html
Vue + Openlayers學習:https://www.jianshu.com/p/fd399ad4b7d8(文后有源碼鏈接)
OpenLayers開源代碼:https://github.com/openlayers/openlayers
安裝環境

下載Openlayers發布版本
https://github.com/openlayers/openlayers/releases
我這里下載的是4.6.5,之后解壓。
安裝ol包
npm install ol
注意:此包可能會沖突,可以在外面安裝好了拷貝到node_modules里面,如果是其他項目安裝ol一般不會沖突。
運行Openlayers
npm run
運行此命令會得到運行建議

這里我們運行開發模式serve-examples:


瀏覽器查看:

構建
使用命令之后會在build目錄生成響應的輸出,如需要對ol重新打包運行
npm run build-package

Vue 集成OpenLayers
百度雲盤:https://pan.baidu.com/s/1sLRUJrN8iRuuroL-b2u0Kg

地圖效果:

