Home > Software engineering >  How to output the value
How to output the value

Time:11-28

new Vue({
  data: {
      ban : [{
          name : 'folder1',
          active : 1,
        },
        {
          name : 'folder2',
          active : 0,
        },
      ]
    }
  }
})

How to get the active value without using v-for

I try this way $ban[0] I get the first object, but if I use it, $ban[0].active then an error

CodePudding user response:

try this $ban[0]?.active or $ban[0] && $ban[0].active

  • Related