import polymer core-scaffold breaks google maps

两盒软妹~` 提交于 2020-01-15 12:57:25

问题


I have some working dart polymer code that shows a google map with some markers on it. It took me a while to get those to show up, as it seems the initialization routines are a bit wonky and it's as if sometimes there is not enough time to load the map div before it tries to render. Anyway, as I said I got that working. Now I wanted to put a core-scaffold around it, as they do on many demos. The minute I add this line...

<link rel="import" href="packages/core_elements/core_scaffold.html">

...the whole thing breaks, i get the console error:

Exception: Class 'GElement' has no instance method '[]'.

NoSuchMethodError: method not found: '[]'
Receiver: Instance of 'GElement'
Arguments: ["maps"]

I commented out all other lines and reduced it to just that one.


回答1:


(As of today), using DartEditor 1.5.8 and upgrading to polymer 0.12.0

dependencies:
  polymer: '>=0.12.0 <0.13.0'

this upgrades core_element and paper_element to 0.1.x (was 0.0.x before). This now looks fixed (although there seems to be still issues with icon by ids) and I'm able to run a simple scaffold example (https://github.com/dart-lang/core-elements/blob/master/example/core_scaffold.html). you might want to give it another try!




回答2:


I once ran into a very similar error message when I first tried to use google_maps and eventually figured out that the problem was that I was missing this line in my index.html.

<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>


来源:https://stackoverflow.com/questions/24984742/import-polymer-core-scaffold-breaks-google-maps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!