簡體   English   中英

在ember.js中導入openlayers3

[英]import openlayers3 in ember.js

我正在啟動一個旨在繪制和顯示地圖的ember.js應用程序。

我使用的是ember.js v1.11.0和ol3 v3.4.0

我設法通過bower安裝ol3並使用Brocfile.js導入它:

app.import('bower_components/ol3/build/ol.js');
app.import('bower_components/ol3/css/ol.css');

我可以在我的視圖中使用它也沒有問題,等等。如果可能,我想要擺脫服務器錯誤:

views/map.js: line 6, col 22, 'ol' is not defined.
views/map.js: line 7, col 19, 'ol' is not defined.
views/map.js: line 10, col 21, 'ol' is not defined.
views/map.js: line 11, col 19, 'ol' is not defined.
views/map.js: line 14, col 19, 'ol' is not defined.
views/map.js: line 17, col 17, 'ol' is not defined.

如果可能的話,在我的Intellij IDEA中獲得自動完成功能(讓它識別ol庫)

如果有人可以幫助我,那么這個問題就會變得更加渺茫。

ol添加到.jshintrc文件中。 在predef數組中:

"predef": [
  "document",
  "window",
  "-Promise",
  "ol"
]
....

對於intellij-idea,您應該能夠從這里的文檔中獲得答案: https ://www.jetbrains.com/idea/help/configuring-javascript-libraries.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM