我遇到了与Polymer 3 - Google Maps相同的问题。在阅读了上面的帖子后,我似乎缺少这两个文件google-apis/google-maps-api.js
和google-map-marker.js
.
希望它能下载谷歌地图的所有依赖文件,我发出了这些命令:
npm install @em-polymer/google-map
npm install google-maps
npm install
我究竟做错了什么?
我遇到了与Polymer 3 - Google Maps相同的问题。在阅读了上面的帖子后,我似乎缺少这两个文件google-apis/google-maps-api.js
和google-map-marker.js
.
希望它能下载谷歌地图的所有依赖文件,我发出了这些命令:
npm install @em-polymer/google-map
npm install google-maps
npm install
我究竟做错了什么?
这对我有用。
import { html } from '@polymer/lit-element';
import '@em-polymer/google-map/google-map.js';
import '@em-polymer/google-map/google-map-marker.js';
import { PageViewElement } from './page-view-element.js';
// These are the shared styles needed by this element.
import { SharedStyles } from './shared-styles.js';
class MyView1 extends PageViewElement {
render() {
return html`
${SharedStyles}
<section>
<h2>Static page</h2>
<p>This is a text-only page.</p>
<p>It doesn't do anything other than display some static text.</p>
</section>
<section>
<style>
google-map {
height: 600px;
}
</style>
<google-map latitude="39.84143133531688" longitude="-117.4895451470561" api-key="1234"></google-map>
</section>
`;
}
}
window.customElements.define('my-view1', MyView1);