Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
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!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

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).

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda