[Vuejs]-Set checkbox checked if value same vuejs

0👍

✅

If I understand correctly, you want the checkbox checked for each entry in menu whose id appears as a menu_id in grupMenu.

So write a method like this:

isInGrupMenu(id) {
    return this.grupMenu.some((item) => item.id_menu === id);
}

and bind it to the checked attribute of each checkbox:

      <input type="checkbox" :checked="isInGrupMenu(menu.id)">

Leave a comment