【问题标题】:Binding between two webcomponents: Google map + geo-localisation两个 web 组件之间的绑定:谷歌地图 + 地理定位
【发布时间】:2014-12-17 04:07:46
【问题描述】:

我正在尝试将 webcomponent google-map 与组件地理位置一起使用,如第三个示例所示: http://ebidel.github.io/geo-location/components/geo-location/

HTML:

<geo-location latitude="{{lat}}" longitude="{{lng}}"></geo-location>
<google-map latitude="{{lat}}" longitude="{{lng}}" showcentermarker></google-map>

但我的问题是,{{lat}} 和 {{lng}} 值永远不会在运行时为 google-map 组件更新。

运行时间:

<google-map fit="" showcentermarker="" latitude="{{lat}}" longitude="{{lng}}"></google-map>
<geo-location latitude="13" longitude="-73.57572912" watchpos=""></geo-location>

【问题讨论】:

    标签: javascript google-maps polymer web-component


    【解决方案1】:

    我怀疑你正在使用这样的元素:

    <body>
      <geo-location ...></geo-location>
      <google-map ...></google-map>
    </body>
    

    但声明性数据绑定只能在 Polymer 元素内使用,或者如果你用 template is="auto-binding" 包围它们:

    <body>
      <template is="auto-binding">
        <geo-location ...></geo-location>
        <google-map ...></google-map>
      </template>
    </body>
    

    有关更多信息,请参阅文档中的 "Using the auto-binding template element" 章节。

    【讨论】:

      猜你喜欢
      • 2011-01-16
      • 1970-01-01
      • 2012-04-29
      • 2017-12-02
      • 1970-01-01
      • 2012-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多