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

280
Views
How to edit data in JS file from .VUE file?

TEST.VUE

<template>
  <div>
    <button @click="test()">test</button>
    <button @click="adddata()">add</button>
  </div>
</template>
<script>
import logs from './data.js'
export default {
    data () {
        return {
        logitems: logs.data().infomation,
    }
    },
    methods:{
      test(){
         console.log(logs.data().infomation)
      },
      adddata(){

        //FAIL
        logs.data().infomation.log1d = logs.data().infomation.log1d+1
        console.log(logs.data().infomation)

        //PASS
        this.logitems.log1d=this.logitems.log1d+1
        console.log(this.logitems)
      }
    }
}
</script>

DATA.JS

export default {
  data() {
    return {
      infomation: {
        log1d: 1,
        logDetail: "This is some log detail for log 1",
        logType: "general",
        createdBy: "name",
        CreatedAt: "date",
      },
    };
  },
};

from the above code If I run the fetched DATA in TEST.VUE I can update the data. But if fetching data from DATA.JS when I fetch data The information will not be updated. What can I do to get the data on DATA.JS to be modified?

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