个性化阅读
专注于IT技术分析

Polymerjs paper-dropdown下拉菜单

“Polymerjs “纸张下拉菜单是一个简单的下拉菜单, 用于处理可选内容。使用以下命令将该元素安装在你的项目目录中, 并在你的应用程序中使用。

bower install --save PolymerElements/paper-dropdown-menu
paper-dropdown下拉菜单1
bower install --save PolymerElements/paper-item
paper-dropdown下拉菜单2
bower install --save PolymerElements/paper-listbox
paper-dropdown下拉菜单3

例子

创建一个index.html文件, 并在其中添加以下代码, 以查看Polymer.js中paper-dropdown-menu元素的使用。

<!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-dropdown-menu/paper-dropdown-menu.html">
<link rel = "import" href = "bower_components/paper-item/paper-item.html">
<link rel = "import" href = "bower_components/paper-listbox/paper-listbox.html">

<dom-module id = 'my-app'>
   <template>
      <style is = "custom-style">
         paper-dropdown-menu {
            width:250px;
         }
         paper-dropdown-menu {
            height: 200px;
            display: block;
         }
      </style>
      
      <h3>Paper-Dropdown-Menu Example </h3>
      <paper-dropdown-menu>
         <paper-listbox class = "dropdown-content" selected = "1">
            <paper-item>Java Tutorial</paper-item>
            <paper-item>C Tutorial</paper-item>
            <paper-item>PHP Tutorial</paper-item>
            <paper-item>C++ Tutorial</paper-item>
         </paper-listbox>
      </paper-dropdown-menu>
   </template>
   
   <script>
      Polymer ({
         is: 'my-app', ready: function() {
            this.async(function() {         
            });
         }
      });
   </script>
</dom-module>

输出

paper-dropdown下拉菜单4
赞(0)
未经允许不得转载:srcmini » Polymerjs paper-dropdown下拉菜单

评论 抢沙发

评论前必须登录!