Answer the question
In order to leave comments, you need to log in
How to insert data from a specific store vuex object?
I will describe the situation. I have some local "database" db.json. It stores information in objects about several form fields (for example, label text, id, etc.). I need to get the data of a certain object from the component and insert it on the page.
For example, db.json has an object:
"cardNumber": {
"id": "v-card-number",
"label": "Номер карты",
"errorLabel": "Неверный номер карты",
"helpText": "",
"isShow": true
},
<span>{{ FIELDS.cardNumber.label }}<span/>
<li v-for="field in FIELDS"><li/>
Answer the question
In order to leave comments, you need to log in
In general, I did it differently. In the data component, I wrote the fields object with field objects (for example,
data() { fields: { phone: {}, email: {}, etc. }}). In watch I did the following:
FIELDS (data) {
this.fields.email = data.fields.email
//И так для каждого поля далее....
}
<span>{{ fields.email.label }}</span>
<-- и так далее... -->
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question