您的位置:首页 > 产品设计 > UI/UE

vue 循环加载数据并获取第一条记录

2017-06-14 18:14 357 查看
 最近使用elment ui和vue.js,遇到需要像c:foreach类似的效果,就找了

      vue的API:https://cn.vuejs.org/v2/guide/list.html#v-for-with-v-if

      element ui:http://element.eleme.io/#/zh-CN/component/input

用法:

<el-card class="box-card"  v-for="(month,index)  in monthdata"
v-if="index==0"  v-bind:month="month" v-bind:index="index">
<div slot="header" class="clearfix">
<span style="line-height: 36px;font-size:17px ;color:#666 ;">
<i style="color:#20a0ff ;font-style: normal;"> {{ index }} - {{ month.C_YEAR_MONTH }}</i> 月度目标
</span>
<i style="float: right;color:#20a0ff;line-height: 36px;cursor: pointer;"
class="el-icon-caret-bottom" v-on:click="change()"></i>
</div>
</el-card>
index就是索引,从0开始,v-if="index==0"就是获取数据集合的第一个,如果展示全部就不要加此条件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐