我是靠谱客的博主 开朗睫毛膏,这篇文章主要介绍vue.js 中 v-for 循环动态循环的div,并列一排,如果使最后一个div没有margin-right:10px,现在分享给大家,希望可以做个参考。

<div
v-for="(node,index) in circlesTemp"
class="bgColorJq"
:class="(index + 1) % circlesTemp.length == 0 ?'noright':'margin-right-10'"
:style="{'background-color':node.bgColor}">
</div>
// 1、在vue中 class 与
:class 是不冲突的,
// 2、(index + 1) % circlesTemp.length == 0 ?'noright':'margin-right-10'" 这格是关键性代码,
//样式
<style>
.noright{
margin-right:0;
}
.margin-right-10{
margin-right:10px;
}
</style>

最后

以上就是开朗睫毛膏最近收集整理的关于vue.js 中 v-for 循环动态循环的div,并列一排,如果使最后一个div没有margin-right:10px的全部内容,更多相关vue.js内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(111)

评论列表共有 0 条评论

立即
投稿
返回
顶部