Vuejs directive to update value in another field

Asked

Viewed 65 times

1

Hello, I’m new in vuejs, I’m putting together a system to calculate the weight of a product... I have a vuetify combobox where will make available the product name, (I made an object array, name:'name',value:99) below on an H4 tag I want to pass the value, someone knows how to do this ?

<h2>Selecione o produto</h2>
<v-combobox
  :items="produtos"
  item-value="produtos"
  item-text="nome"
  id="prod">
</v-combobox>

<h4 >Valor: {{produtos.valor}}</h4>
<h2>Digite o peso do produto:</h2>
<v-text-field></v-text-field>
<h4>Valor final {{produtos.valor}}</h4>
data: {
  nomesCli: [
    'Felipe',
    'luan'
  ],
  produtos: [
    {nome: 'Costela 481' , valor: 99},
    {nome: 'Picanha angus' , valor: 120},
    {nome: 'Contra filé' , valor: 150},
  ]

1 answer

0

good morning,

You are using the notation of an object in an array. I mean, I think you have to choose the

{{produtos[0].valor}}

or does so make a v-for for all products:

<div v-for="(produto, i) in produtos" :key="i">
  <h4>{{ produto[i].valor }}</h4>
</div>

I hope it helps =)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.