问题
如何创建
<paper-button>
具有以下特征的组 UI 元素?
- 它是一组
<paper-button>
元素。 - 它是垂直堆叠的。
- 每个按钮填充容器的整个宽度(没有边距、填充或水平空白)。
- 按钮之间没有边距、填充或垂直空白。
例子:
- 我正在寻求的效果类似于
<body fullbleed>
仅限于按钮的父容器。 - 类似于此处显示的引导程序“垂直变化” 。
- 如果您有Google Drive,请将鼠标悬停在页面左边距的菜单项上。(在标有“新建”的红色按钮下。)
- 做一个谷歌搜索。搜索字段中出现的下拉菜单预测性地建议您想要的可能问题也是我所追求的外观/感觉的另一个示例。
尝试:
请参阅下面的代码以了解我以前的尝试:
<p>
使用标签堆叠垂直按钮和- 使用
<paper-menu>
.
研究:
演示: JS Bin
代码:
<!doctype html>
<html>
<head>
<title>polymer</title>
<script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents-lite.js"></script>
<link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html">
<link rel="import" href="https://rawgit.com/PolymerElements/paper-button/master/paper-button.html">
</head>
<body>
<dom-module id="x-test" noscript>
<template>
<!-- Attempt #1: Stacking Buttons -->
<div id="container">
<p><paper-button>One</paper-button></p>
<p><paper-button>Two</paper-button></p>
<p><paper-button>Three</paper-button></p>
</div>
<!-- Attempt #2: <paper-menu> -->
<paper-menu>
<paper-item>One</paper-item>
<paper-item>Two</paper-item>
<paper-item>Three</paper-item>
</paper-menu>
</template>
</dom-module>
<x-test></x-test>
</body>
</html>