vue中forEach循环数组如何获取指定数据
这篇文章主要介绍了vue中forEach循环数组如何获取指定数据,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
如下所示:
<el-checkbox v-for="(item) in jurisdictionContent" :label="item.id" :key="item.id" class="checkboxMargin"> <span>{{item.value}}{{item.checked}}</span> </el-checkbox>
handleJurisdiction(index, row) {//获取权限 this.selectedCheck=[]; let me = this; this.jurisdiction = true; this.roleId = row.id; this.$http.get("/role/resources", { params: {roleId: this.roleId} }, { emulateJSON: true }).then((response) => { me.jurisdictionContent = response.body; me.jurisdictionContent.forEach(function (c) { if(c['checked']){ me.selectedCheck.push(c.id); } }) console.log(this.selectedCheck) })
vue 中标签里循环使用v-for,方法里面循环使用forEach。
感谢你能够认真阅读完这篇文章,希望小编分享的“vue中forEach循环数组如何获取指定数据”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注行业资讯频道,更多相关知识等着你来学习!