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

131
Views
Inertia+Vue3, How to get the value of a ref property and pass it as route() parameter?

I need to get the value of a reference property and pass this value in the <Link :route()> parameter

My code in Component.vue

 <div class="item" v-for="item in props.user.items" :key="item.id">

<Link :href="route('user.route', {id: item.id, ll: getCurrentRef() })">Go to edit</Link>

<div>
<TextInput type="number" :id="`ll_${item.id}`" name="ll" :value="item.ll?0"
@keyup="setCurrentRef($event.target.value);" />
</div>

</div>

<input type="text" ref="element" id="element" value="XX">

<script setup>
import {ref, onMounted} from 'vue';

const element = ref(null)

const setCurrentRef = (value) => {
 element.value.value = value;
}

const getCurrentRef = () => {
 return element.value.value = value;
}

onMounted(() => {
 //alert(element.value.value)
});

I can set the value of ref element in @keyup with setCurrentRef() method normally, but I don't get the value with getCurrentRef() method

In onMounted, when I refresh the page, I see the first value of the element which is "XXX", but if you put this return "alert(item.value.value)" in a function and call it anywhere, this returns an alert. with "undefined"

In the console, the error that appears is: Uncaught (in promise) ReferenceError: value is not defined.

over 2 years ago · Carlos Garzón Colorado
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!