uniapp 判断v-for是否为最后一个元素,并修改其样式

uniapp 判断v-for是否为最后一个元素,并修改其样式

<view class="am-list" style="width: 96%; margin-left: 2%;font-size: 16px;font-family: sans-serif;margin-bottom: 20rpx;">
    <view  v-for="(item,index) in menu" :key="index" class="am-list-item" :style="index===menu.length-1?'border-bottom-width: 0rpx;':''">
        {{item.MC}}
        <span class="am-icon am-icon-arrow-horizontal"></span>
    </view >
</view>
:style="index===menu.length-1?'border-bottom-width: 0rpx;':''"

使用三目运算符,进行判断

posted @ 2020-10-12 12:02  STR少寒  阅读(2926)  评论(0编辑  收藏  举报