vue遍历对象中的数组取值⽰例
前⼏天⼩项⽬,没考虑周全,让后端改接⼝,改成数组中包含对象中包含数组的形式,后来越琢磨越不对,后台把所有数据放在了⼀个对象⾥,我拿弹窗数据不好拿,索性⼜改了回来,把后端折腾够呛,⾃⼰也折腾够呛,发上来,以⽰警戒
改前拿数据
<div class='your-container'>
<div class="sortText">
<div>综合排序</div>
<div class="sortHot" @click="mostHot"><p>最热</p><div class="sortImg"><img src="../../assets/imgs/mosthot.png" alt=""></div></div>
<div class="sortHot" @click="mostNew"><p>最新</p><div class="sortImg"><img src="../../assets/imgs/mostview.png" alt=""></div></div>
<div class="adhibition" @click="adhibition(0)">应⽤</div>
<div class="adhibition" @click="adhibition(1)">算法</div>
</div>
<!-- bind your configurations -->
<vue-scroll :ops="ops">
<div class='your-content'>
<ul class="listBox" @handle-resize="handleResize">
<li v-for="(item,index) in list" :key="index" class="lis">
<div class="listIcon">
<img src="../../assets/imgs/jicon.png" alt="">
</div>
<div class="listText">
<div class="names">{{ame}}</div>
<div class="introduce">
{{item.introduce}}
<div class="details" @click="detailsClick">详情</div>
</div>
<div class="spans" v-for='(value,key,idx) in item' :key='idx'>
<p v-if='String.call(value).slice(8,-1) == "Array"'><span>{{value[0]}}:</span><span class="lastname">{{value[1]}}</span></p>
</div>
<div class="lineBox">
<div class="lineoneBox"><img src="../../assets/imgs/line1.png" alt=""></div>
<div class="whiteBox"></div>
</div>
</div>
</li>
</ul>
</div>
</vue-scroll>
<detailsPopUp @manage="manshow" v-if="manageshow"/>
</div>
改后
<div class='your-container'>
<div class="sortText">
<div>综合排序</div>
<div class="sortHot" @click="mostHot"><p>最热</p><div class="sortImg"><img src="../../assets/imgs/mosthot.png" alt=""></div></div>
<div class="sortHot" @click="mostNew"><p>最新</p><div class="sortImg"><img src="../../assets/imgs/mostview.png" alt=""></div></div>
<div class="adhibition" @click="adhibition(0)">应⽤</div>
<div class="adhibition" @click="adhibition(1)">算法</div>
</div>
<!-- bind your configurations -->
<vue-scroll :ops="ops">
<div class='your-content'>
<ul class="listBox" @handle-resize="handleResize">
<li v-for="(item,index) in list" :key="index" class="lis">
<div class="listIcon">
<img src="../../assets/imgs/jicon.png" alt="">
</div>
<div class="listText">
<div class="names">{{ame}}</div>
<div class="introduce">
{{item.introduce}}
<div class="details" @click="detailsClick(item.ade,item.interfaceClassName)">详情</div>
</div>
<div class="spans" >
后端字符串转数组<p><span>提供⼚商:</span><span class="lastname">{{item.manufacturerName}}</span></p>
<p v-show="pe==0"><span>使⽤总次数:</span><span class="lastname">{{alCount}}</span></p>
<p v-show="pe==0"><span>安装时间:</span><span class="lastname">{{ateTime}}</span></p>
<p v-show="pe==1"><span>平均响应时间:</span><span class="lastname">{{item.avgResponseTime}}</span></p>
<p v-show="pe==1"><span>准确率:</span><span class="lastname">{{item.accuracyRate}}%</span></p>
<p v-show="pe==0"><span>占⽤内存:</span><span class="lastname">{{}}</span></p>
</div>
<div class="lineBox">
<div class="lineoneBox"><img src="../../assets/imgs/line1.png" alt=""></div>
<div class="whiteBox"></div>
</div>
</div>
</li>
</ul>
</div>
</vue-scroll>
<detailsPopUp @manage="manshow" v-if="manageshow" :scrollDataverson="detailsverson" :scrollDatatrade="detailstrade" :scrollDatainterfaceClassName="detailsinterfaceClassName"/> </div>
以上这篇vue遍历对象中的数组取值⽰例就是⼩编分享给⼤家的全部内容了,希望能给⼤家⼀个参考,也希望⼤家多多⽀持。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。