概述
要想判断数组对象中嵌套的数组对象中是否有字段isBig==true
可以采用计数器的方法
if (type == 'all') {
let current = 0 // eslint-disable-line no-unused-vars
list.map((item, index) => {
for (const item of item.pkgItemList) {
if (item.isBig == true) {
current++
}
}
})
if (current > 0) {
this.$confirm(this.$t('order.ConfirmCreatePkg'), this.$t('button.Confirm'), {
confirmButtonText: this.$t('button.Confirm'),
cancelButtonText: this.$t('button.Cancel'),
type: 'warning'
})
最后
以上就是疯狂发箍为你收集整理的判断数组对象嵌套的数组对象中是否含有某个字段的全部内容,希望文章能够帮你解决判断数组对象嵌套的数组对象中是否含有某个字段所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复