[Vuejs]-How to check a box in a Vuejs nested conditional statement

0👍

This may help you

checkIfExists(role, product){
            if( this.permissions.map(permission => (permission.data.role_id === role.data.role_id && permission.data.product_id === product.data.product_id) ? true : false).includes(true) ){
                return true;
            }
        },

0👍

Your checkIfExists method should be

checkIfExists(role, product) {
      return this.permissions.some(
        (permission) =>
          permission.data.role_id === role.data.role_id &&
          permission.data.product_id === product.data.product_id
      );
    },

Here’s a sample

Leave a comment