H
H
Horus1232020-07-12 19:45:50
Vue.js
Horus123, 2020-07-12 19:45:50

How to pass new value to store?

Good afternoon.
A list of forms is displayed. A list of users is loaded into each form. When you click on the "Assign" button of the selected user in the selected form, the name of the form is pushed into the object with user data (forms array on the 2nd screenshot).

5f0b2dfc8eedf644144592.png

5f0b2cbdaee4d051539410.png

parent component

.ready-forms__title Созданные формы
            readyFormCard(v-for='(item, index) in this.ALLFORMS'
                        :key='item.id'
                        :info='item')


readyFormCard
.form-card
    .form-card__title {{info.title}}
    ul.choice-people__filters-people
               li ФИО
               li Логин
               li Действия
    studentsList(v-for="(item, index) in this.STUDENTS"
                            :key='item.id'
                            :student='item'
                            v-bind:form="info").choice-people__filters-people-list

props: {
    info: {
        type: Object}


studentsList
ul
  li {{student.name}}
  li {{student.login}}
  li(@click="giveForm(student)") Назначить

  props: {
      form: {
        type: Object
      },
      student: {
        type: Object
      },
        methods: {
      giveForm (student) {
        student.forms.push(this.form.title)
        this.GIVE_FORM(student)
      }


Can't add value to store. How to save selected form binding to selected user? For example, add the ninth form 37 to the user from the list.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Horus123, 2020-07-13
@Horus123

Probably only confused everyone, but everything was decided using indexOf.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question