Polymer-paper-button

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

ポリマー-ペーパーボタン

ペーパーボタンは、接点から波及効果があるシンプルなボタンです。 ディレクトリ内のペーパーボタンを取得するには、コマンドプロンプトで次のコマンドを使用する必要があります。

bower install --save PolymerElements/paper-button

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

<!doctype html>
<html>
   <head>
      <link rel = 'import' href = 'my-appl'>
   </head>

   <body>
      <h2>Paper-Button Example</h2>
      <my-app></my-app>
   </body>
</html>

次に、my-applファイルを開き、次のコードを含めます。

<link rel = 'import' href = 'bower_components/polymer/polymerl'>
<link rel = "import" href = "bower_components/paper-button/paper-buttonl">
<link rel = "import" href = "bower_components/paper-styles/paper-stylesl">
<dom-module id = 'my-app'>
   <template>
      <div class = "container">
         <paper-button toggles raised class = "green">Active</paper-button>
         <paper-button disabled class = "disabled">Disabled</paper-button>
      </div>

      <div class = "container" ></div>
      <style is = "custom-style">
         #container {
            display: flex;
         }
         paper-button {
            font-family: 'Roboto', 'Noto', sans-serif;
            font-weight: normal;
            font-size: 14px;
            -webkit-font-smoothing: antialiased;
         }
         paper-button.green:hover {
            background-color: var(--paper-green-400);
         }
         paper-button.green {
            background-color: var(--paper-green-500);
            color: white;
         }
         paper-button.green[active] {
            background-color: var(--paper-red-500);
         }
         paper-button.disabled {
            color: black;
            background-color:#969696;
         }
      </style>
   </template>

   <script>
      Polymer ({
         is: 'my-app',
         ready: function() {
            this.async(function() {
            });
         }
      });
   </script>
</dom-module>

出力

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

polymer serve

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

ポリマー紙ボタン