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

102
Views
Using props how to update the data in Vuejs?

component

<template>
  <div>
    <b>Vuejs dynamic routing</b>
    <div v-for="item in items" :key="item.id">
      <b>{{ item.id }}.</b> &nbsp;&nbsp;&nbsp;
      <router-link
        @update="updateValue"
        :to="{ name: 'UserWithID', params: { id: item.id, items: items } }"
      >
        {{ item.val }}{{ item.kk }}
      </router-link>
    </div>
    <br /><br /><br />

    {{ $route.params.id }}
  </div>
</template>
 

Using props how to update the data in Vuejs?

I have two components called, helloworld, User. And i have mocked the data inside of helloworld.vue. Now using the props the want to get he data inside of the User component and preform the update operation . When trying to preform the logic.

Where onclick of button. it is going to method, But not updating the logic

I have kept console. inside method. and its printing. but logic not updating

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As mentioned in the comments you are getting errors in the console as you are not passing the items as props to the User component and it is a required field in the User component.

And for the second point, you should store data in a separate file not in the main component so the items array doesn't get initialized again when the parent component is rendered again. The best option would be a global store(vuex) for sake of simplicity, it is done a separate file for now just as an example.

Here is a sample sandbox hope it helps:

https://codesandbox.io/s/exciting-ptolemy-35bsb?file=/src/components/User.vue

about 4 years ago · Juan Pablo Isaza 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!