Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

236
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!