[Vuejs]-How do you access array data in a computed function with Vue.js

0👍

You have to update properties in v-model directives, too.

<currency-input label="Price" v-model="products[0].price"></currency-input>
<currency-input label="Shipping" v-model="products[0].shipping"></currency-input>
<currency-input label="Handling" v-model="products[0].handling"></currency-input>
<currency-input label="Discount" v-model="products[0].discount"></currency-input>

This ansewers your question. However, your data structure seems wired. Why you need a array here while you sum only first product? Your total computed property do not sum all other products anyway.

Leave a comment