D
D
Denioo2020-06-19 15:28:02
JavaScript
Denioo, 2020-06-19 15:28:02

How to create multy-checkbox in vue?

Do not tell me, otherwise I have been suffering for half a day, how to create a multi checkbox on vue, i.e. there is a main checkbox, when clicked, all other checkboxes change their state to checked or remove checked. By default, all checkboxes have a checked state. The difficulty itself is that if you click on any other checkbox (not the main one), then the main checkbox should be wrung out, or if you first clicked on the main checkbox, then the checked state is removed from everyone, and then you choose yourself, you also need to catch id on which you click. It’s easy on pure js, but now I’m studying vue and I want to figure it out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Glebov, 2020-06-19
@Denioo

You do the Main Checkbox separately, hang a method on it that will go through the mainCategories and replace isChecked with the one you need
in the v-model checkbox, also pass true or false, i.e. Category.isChecked you have
https://ru.vuejs. org/v2/guide/forms.html#%D0%A7%D0...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question