高分子铁单
Polymer iron-list
我想使用 iron-list 显示带有顶部和底部边距的项目网格,但没有 results.I 使用 polymer 2.0 和 iron-list 2.0.16。
当我突出显示 iron-list 中的任何项目时,边距不会显示,但会出现在 devtools 中。我不知道我没有做什么 right.I 尝试修复它但没有成功。
...
:host {
display: block;
padding: 10px;
}
.country {
height: 50px;
width: 300px;
background-color: white;
margin: 16px 0;
}
iron-list {
height: 100vh;
}
</style>
<data-story-data region="africa" countries="{{countries}}"></data-story data>
<iron-list items="[[countries]]" as="country" scroll-target="document" grid>
<template>
<div class="country">
<p>[[country.name]]</p>
</div>
<!--
<paper-card>
<div class="card-content">
<div>[[country.name]]</div>
</div>
<div class="card-actions">
<a href="[[rootPath]]detail/country/[[country.name]]/[[country.alpha2Code]]/about" tabindex="-1">
<paper-button raised>view</paper-button>
</a>
</div>
</paper-card>
-->
</template>
</iron-list>
...
这就是我得到的
我该怎么做才能使 16px 的顶部和底部边距正常工作。提前致谢。
列表项显示 0 像素边距,因为 iron-list
覆盖了它们:
铁-list.html
<style>
/* ... */
#items > ::slotted(*) {
box-sizing: border-box;
margin: 0; /* Here */
position: absolute;
top: 0;
will-change: transform;
}
/* ... */
</style>
尝试将您的卡片包裹在一个容器中,并使用其填充而不是边距来获得您想要的间距:
<style>
.country {
padding: 16px 0;
}
</style>
<iron-list items="[[countries]]" as="country" scroll-target="document" grid>
<template>
<div class="country">
<paper-card>
<div class="card-content">
<div>[[country.name]]</div>
</div>
<div class="card-actions">
<a href="[[rootPath]]detail/country/[[country.name]]/[[country.alpha2Code]]/about" tabindex="-1">
<paper-button raised>view</paper-button>
</a>
</div>
</paper-card>
</div>
</template>
</iron-list>
我想使用 iron-list 显示带有顶部和底部边距的项目网格,但没有 results.I 使用 polymer 2.0 和 iron-list 2.0.16。 当我突出显示 iron-list 中的任何项目时,边距不会显示,但会出现在 devtools 中。我不知道我没有做什么 right.I 尝试修复它但没有成功。 ...
:host {
display: block;
padding: 10px;
}
.country {
height: 50px;
width: 300px;
background-color: white;
margin: 16px 0;
}
iron-list {
height: 100vh;
}
</style>
<data-story-data region="africa" countries="{{countries}}"></data-story data>
<iron-list items="[[countries]]" as="country" scroll-target="document" grid>
<template>
<div class="country">
<p>[[country.name]]</p>
</div>
<!--
<paper-card>
<div class="card-content">
<div>[[country.name]]</div>
</div>
<div class="card-actions">
<a href="[[rootPath]]detail/country/[[country.name]]/[[country.alpha2Code]]/about" tabindex="-1">
<paper-button raised>view</paper-button>
</a>
</div>
</paper-card>
-->
</template>
</iron-list>
...
这就是我得到的
我该怎么做才能使 16px 的顶部和底部边距正常工作。提前致谢。
列表项显示 0 像素边距,因为 iron-list
覆盖了它们:
铁-list.html
<style>
/* ... */
#items > ::slotted(*) {
box-sizing: border-box;
margin: 0; /* Here */
position: absolute;
top: 0;
will-change: transform;
}
/* ... */
</style>
尝试将您的卡片包裹在一个容器中,并使用其填充而不是边距来获得您想要的间距:
<style>
.country {
padding: 16px 0;
}
</style>
<iron-list items="[[countries]]" as="country" scroll-target="document" grid>
<template>
<div class="country">
<paper-card>
<div class="card-content">
<div>[[country.name]]</div>
</div>
<div class="card-actions">
<a href="[[rootPath]]detail/country/[[country.name]]/[[country.alpha2Code]]/about" tabindex="-1">
<paper-button raised>view</paper-button>
</a>
</div>
</paper-card>
</div>
</template>
</iron-list>