Polymer-paper-card

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

ポリマー-紙カード

紙のカードは、一意の関連データを含むシンプルなマテリアルデザインの紙です。 ディレクトリ内の紙のカードを取得するには、コマンドプロンプトで次のコマンドを使用する必要があります。

bower install --save PolymerElements/paper-card

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

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

   <body>
      <h2>Paper-Card 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">
<link rel = "import" href = "bower_components/paper-card/paper-cardl">
<link rel = "import" href = "bower_components/iron-icons/iron-iconsl">
<link rel = "import" href = "bower_components/iron-icons/communication-iconsl">

<dom-module id = 'my-app'>
   <template>

      <style is = "custom-style">
         body {
            display: flex;
            align-items: center;
            justify-content: center;
         }

         paper-card {
            max-width: 500px;
         }

         .cafe-header { @apply(--paper-font-headline); }
         .cafe-light { color: var(--paper-grey-600); }
         .cafe-location {
            float: right;
            font-size: 15px;
            vertical-align: middle;
         }

         .cafe-reserve { color: var(--google-blue-500); }
         iron-icon.star {
            --iron-icon-width: 16px;
            --iron-icon-height: 16px;
            color: var(--paper-amber-500);
         }
      </style>

      <paper-card >
         <div class = "card-content">
            <div class = "cafe-header">finddevguides</div>
            <div class = "cafe-rating">
               <iron-icon class = "star" icon = "star"></iron-icon>
               <iron-icon class = "star" icon = "star"></iron-icon>
               <iron-icon class = "star" icon = "star"></iron-icon>
               <iron-icon class = "star" icon = "star"></iron-icon>
               <iron-icon class = "star" icon = "star"></iron-icon>
            </div>

            <p>Free Tutorials</p>
            <p class = "cafe-light">Enjoy theory and lab at the same time, right here
               online. An online Lab for IT Professionals</p>
         </div>
      </paper-card>
   </template>

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

出力

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

polymer serve

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

ポリマー紙カード