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

215
Views
how can i use variable declared inline in vue js?

I'm working with Vue.js (version 3) and I wanted to do something like this:

<div v-for="item in list" v-if="item.someAttribute === someOtherVariable">

but Vue returns the error:

Property "item" was accessed during render but is not defined on instance

Since, as I suppose, he's looking for item in data, where I created the Vue app. Is there anyway to solve this issue? Maybe some workaround to obtain the same effect?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

It's not recommended to use v-if and v-for on the same element due to implicit precedence.

according to the official docs

so you should do :


<template v-for="item in list">
  <div v-if="item">
    ....
  </div>
</template>
about 4 years ago · Santiago Trujillo Report

0

You can not access v-for and v-if in the same line, if you do so Priority has been given to your v-if condition , this was the reason you are getting that error

<div v-for="item in list">
  <span v-if="item.someAttribute === someOtherVariable">...</span>
</div>
about 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!