【Polymerjs paper-drawer-panel元素】Polymerjs 纸制抽屉面板是一个抽屉面板, 可用于滑入/滑出以隐藏/露出主面板。默认情况下, 它的位置是主面板的左侧。抽屉将以狭窄的布局堆叠在主面板的顶部。
打开命令提示符, 然后使用以下命令在你的目录中获取纸盒面板。
bower install --save PolymerElements/paper-drawer-panel
文章图片
文章图片
例子
创建一个index.html文件, 并在其中添加以下代码, 以查看Polymer.js中paper-drawer-panel元素的用法。
<
!doctype html>
<
html>
<
head>
<
link rel = 'import' href = 'http://www.srcmini.com/my-app.html'>
<
/head>
<
body>
<
my-app>
<
/my-app>
<
/body>
<
/html>
现在, 打开my-app.html文件, 并在其中包含以下代码。
<
link rel = 'import' href='http://www.srcmini.com/bower_components/polymer/polymer.html'>
<
link rel = "import" href="http://www.srcmini.com/bower_components/paper-button/paper-button.html">
<
link rel = "import" href = "http://www.srcmini.com/bower_components/paper-styles/paper-styles.html">
<
link rel = "import" href = "http://www.srcmini.com/bower_components/paper-card/paper-card.html">
<
link rel = "import" href = "http://www.srcmini.com/bower_components/iron-icons/iron-icons.html">
<
link rel = "import" href = "http://www.srcmini.com/bower_components/iron-icons/communication-icons.html">
<
link rel = "import" href = "http://www.srcmini.com/bower_components/paper-checkbox/paper-checkbox.html">
<
link rel = "import" href = "http://www.srcmini.com/bower_components/paper-drawer-panel/paper-drawer-panel.html">
<
dom-module id = 'my-app'>
<
template>
<
style is = "custom-style">
paper-button {color: white;
margin: 10px;
background-color: green;
white-space: nowrap;
}button {display: block;
line-height: 40px;
background-color: transparent;
border: none;
font-size: 14px;
margin: 20px;
}#close { color: white;
margin: 10px;
background-color: red;
white-space: nowrap;
}<
/style>
<
paper-drawer-panel id = "paperDrawerPanel" force-narrow>
<
div drawer>
<
button id = "close" tabindex = "0" paper-drawer-toggle raised>
Close Drawer<
/button>
<
h3>
Welcome to Tutorials point<
/h3>
<
/div>
<
div main>
<
div>
<
paper-button paper-drawer-toggle raised>
Open Drawer<
/paper-button>
<
/div>
<
/div>
<
/paper-drawer-panel>
<
/template>
<
script>
Polymer ({is: 'my-app', ready: function() {this.async(function() {});
}});
<
/script>
<
/dom-module>
推荐阅读
- 6.2Android硬件访问服务编写系统代码
- Polymerjs paper-checkbox元素
- Polymerjs paper-card元素
- Polymerjs paper-badge元素
- Polymerjs paper-button元素
- Polymerjs neon元素
- Polymerjs iron图标iron-icon
- Polymerjs iron-swipable-container元素
- Polymerjs iron-image图像元素