如何在 Polymer 1.0 中实现 firebase-auth 的示例?

An example of how to implement firebase-auth in Polymer 1.0?

我有点不知道如何实现 firebase-auth 元素。任何示例将不胜感激,我还没有找到任何示例。

谢谢

我最终通过将 HackITtoday 的 this 示例元素改编为我的 firebase 网址来获得授权。就像添加元素一样简单:

<hi9-login></hi9-login>

, Glenn Vandeuren 上发布了以下内容:


元素

<!--
@license
Copyright (c) 2015 Glenn Vandeuren. All rights reserved.
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-button/paper-button.html">

<dom-module id="login-button">

  <style>
    :host {
      display: block;
      box-sizing: border-box;
    }
  </style>

  <template>
    <paper-button raised>Login using <span>[[service]]</span></paper-button>
  </template>

</dom-module>

<script>

  Polymer({

    is: 'login-button',

    properties: {
      service: String
    },

    listeners: {
      'tap': '_handleTap'
    },

    _handleTap: function () {
      this.fire('login', this.service);
    }

  });

</script>

索引

<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
    <title>login-button Demo</title>
    <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
    <link rel="import" href="../login-button.html">
  </head>
  <body>

    <login-button service="google"></login-button>
    <login-button service="twitter"></login-button>

    <script>
      document.addEventListener('login', function(service) {
        // handleLogin();
        alert(service.detail);
      });
    </script>

  </body>
</html>