v-for似乎搞亂了元素索引。我有以下代碼:vue js v-for和css n-child
<style>
@media (min-width: 768px) and (max-width: 1199px) {
.grid:nth-child(2) {
clear: left;
background-color: gray;
border: 1px solid yellow;
}
}
</style>
然後在我的代碼:
<div v-for="n in posts">
<div class="grid">{{n}}</div>
</div>
這裏的孩子2不存在。僅在指定了子項1時應用CSS樣式。
任何幫助,將不勝感激
的jsfiddle或plunker將是有益的複製問題。 – Pradeepb