Polymer - 纸质菜单



Paper-menu 是一款简单易用的菜单,采用 Material Design 样式。已选项目文本加粗显示。此元素具有多种选择和按键绑定,用于浏览列表框。若要在工作条件下目录中添加 paper-menu,应在命令提示符下运行以下命令。

bower install --save PolymerElements/paper-menu

示例

您的 index.html 文件应如下所示。

<!doctype html>
<html>
   <head>
      <link rel = 'import' href = 'my-app.html'>
   </head>
   
   <body>    
      <my-app></my-app>
   </body>
</html>

您的 my-app.html 文件应如下所示。

<link rel = 'import' href = 'bower_components/polymer/polymer.html'>
<link rel = "import" href = "bower_components/paper-listbox/paper-listbox.html">
<link rel = "import" href = "bower_components/paper-menu/paper-menu.html">
<dom-module id = 'my-app'>
   <template>
      <style>
         .horizontal-section {
            padding: 15px;     
         }
         #paperitem {
            cursor: pointer;
            display: inline;      
            background: #ccc;
         }
      </style>
      
      <h3>Paper-Menu Example </h3>
      <div class = "horizontal-section">
         <paper-menu>
            <paper-item id = "paperitem">Home</paper-item>
            <paper-item id = "paperitem">About-Us</paper-item>
            <paper-item id = "paperitem">Contacts</paper-item>
            <paper-item id = "paperitem">Log-In</paper-item>
         </paper-menu>
      </div>        
   </template>
   
   <script>
      Polymer ({
         is: 'my-app', ready: function() {
            this.async(function() {         
            });
         }
      });
   </script>
</dom-module>

输出

刷新 Polymer 服务器,以下为输出。

paper-menu
polymer_elements.htm
广告