M
M
Maxim2019-03-26 10:34:04
Vue.js
Maxim, 2019-03-26 10:34:04

Vue how to select all checkboxes?

Hello everyone, I have a question
, I have a table, there is a checkbox component, a copy of the component is generated for each row, through $emit I listen to this component and get its status from the parent with id,
how can I select or remove all checkbox components, using pure js it's easy I can, but using vue, is it possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
inzeppelin, 2019-03-27
@xiiicool

You need to store an object in the parent component that will contain the states of the child checkboxes.

values = {
     id: value,
     ....
};

Accordingly, on $emit you update the value in values. And you pass the same values ​​to child components through props.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question