我是靠谱客的博主 疯狂发箍,这篇文章主要介绍判断数组对象嵌套的数组对象中是否含有某个字段,现在分享给大家,希望可以做个参考。

在这里插入图片描述
要想判断数组对象中嵌套的数组对象中是否有字段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'
  })

最后

以上就是疯狂发箍最近收集整理的关于判断数组对象嵌套的数组对象中是否含有某个字段的全部内容,更多相关判断数组对象嵌套内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(142)

评论列表共有 0 条评论

立即
投稿
返回
顶部