vue中的v-if查找数组中最后一个,给他加上新的样式
作者:互联网
vue:
var app=new Vue({
el:".xiaomi",
data: {
typeInfo: [{img:"image/type/phone_1.webp",name:"Xiaomi 12 Pro",price:"4699"},
{img:"image/type/phone_2.webp",name:"Rog5s",price:"4999"},
],
},
methods: {
},
created: function () {
}
});
html:(给下标索引为1的加上边框)
<ul>
<li v-for("info,index")in typeInfo></li>
<span class="div1" v-if('index[1]')></span>//有边框
<span class=""></span>//没有边框
</ul>
标签:vue,img,image,边框,webp,查找,数组,type,price 来源: https://www.cnblogs.com/zsbb/p/15953553.html