聚合物3-缺少Google Maps文件 [英] Polymer 3 - Google Maps files missing

查看:92
本文介绍了聚合物3-缺少Google Maps文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到与聚合物3-Google Maps 相同的问题.阅读以上线程后,我似乎缺少了两个文件google-apis/google-maps-api.jsgoogle-map-marker.js.

I am having the same issue as Polymer 3 - Google Maps. After reading the above thread, I seem to be missing the two files google-apis/google-maps-api.js and google-map-marker.js.

希望它会为我下载的Google Maps下载所有相关文件:

In the hope it would download all the dependent files for Google Maps I issued these commands:

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);

这篇关于聚合物3-缺少Google Maps文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆