Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
SyntaxError: Assigning to rvalue

I have the following code in tbody

<tr v-for="item in apiResponse.costGroups" :key="item.process_receipt_id">
    <td class="pl-0 pr-0">
        <el-input type="text" v-model="getCostGroupProp(item, 'process_receipt_date')" class="no-border-input-datatable"/>
    </td>
</tr>

in methods object, I have the following code.

methods: {
  getCostGroupProp(costGroup, prop) {
    return costGroup[prop]
  }
}

and I get the following error:

SyntaxError: Assigning to rvalue

However it is working just fine when I write HTML code like this.

<tr v-for="item in apiResponse.costGroups" :key="item.process_receipt_id">
    <td class="pl-0 pr-0">
        <el-input type="text" v-model="item.process_receipt_date" class="no-border-input-datatable"/>
    </td>
</tr>

I have read in one of the questions on StackOverflow that the problem is we cannot have a number in the v-model. But, I don't have a number in the v-model & the code is also working fine with the second approach and with the same set of properties so I don't understand why.

Can anyone help me understand why it is so? I appreciate it. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Do not assign v-model to a method. v-model is two way binding. Use a data property or computed property (with set/get methods).

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda