2017-05-25 168 views
0

通过npm安装openlayers(4.1.1),我可以在vuejs中正常使用openlayers,但是我们公司自定义了一些基于openlayers3.x的东西,那么我怎样才能使用这个自定义的openlayers呢?我直接improt这OL的lib,当使用如何在vuejs中使用openlayers3?

goog.require("ol.Map") 

它报告

goog未定义的错误!

那么,有没有使用在vuejs定制醇的方法呢?触变。

+0

有点困惑 - 你在使用Google Closure吗? – aug

回答

0

您可以安装的openlayers特别版,由package.json提具体的版本,如下列:

"dependencies": { 
    "openlayers": "3.x.x" 
    }, 

之后,你删除早期安装的软件包,并在代码目录做npm install,这将安装正确的版本你需要。