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

时间:2015-07-23 07:41:11

标签: firebase polymer

我对如何实现1元素感到有点迷茫。任何例子都会受到赞赏,我还没有找到任何例子。

由于

2 个答案:

答案 0 :(得分:2)

我最终通过将HackITtoday的this示例元素用于我的firebase网址来获得身份验证。它就像添加像:

这样的元素一样简单
<hi9-login></hi9-login>

答案 1 :(得分:2)

this question上,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>