Polymer-google-hangout-button

提供:Dev Guides
移動先:案内検索

Polymer-Googleハングアウトボタン

Googleハングアウトは、Google Webコンポーネントの要素であり、さまざまなデバイスで他の人との会話を可能にします。

次のコマンドを実行してプロジェクトディレクトリにインストールすることにより、アプリケーションでこの要素を使用できます。

bower install --save GoogleWebComponents/google-hangout-button

次の例では、Polymer.jsでgoogle-hangoutボタン要素の使用を指定しています。 indexlファイルを作成し、その中に次のコードを追加します。

<!doctype html>
<html>
   <head>
      <title>Polymer Example</title>
      <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
      <link rel = "import" href = "bower_components/polymer/polymerl">
      <link rel = "import" href = "bower_components/paper-styles/demo-pagesl">
      <link rel = "import"
         href = "bower_components/google-hangout-button/google-hangout-buttonl">
      <link rel = "import"
         href = "bower_components/iron-flex-layout/classes/iron-flex-layoutl">

      <style>
         section {
            max-width: 300px;
         }
         section > div {
            padding: 5px;
         }
      </style>
   </head>

   <body>
      <section>
         <div class = "layout horizontal center">
            <span class = "flex">Default button</span>
            <span class = "flex"><google-hangout-button></google-hangout-button></span>
         </div>

         <div class = "layout horizontal center">
            <span class = "flex">Narrow button</span>
            <span class = "flex">
               <google-hangout-button width = "70"></google-hangout-button>
            </span>
         </div>
      </section>
   </body>
</html>

出力

アプリケーションを実行するには、作成されたプロジェクトディレクトリに移動し、次のコマンドを実行します。

polymer serve

ここでブラウザを開き、 http://127.0.0.1:8081/ に移動します。 出力は次のようになります。

ポリマーGoogleハングアウトボタン