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

162
Views
Passing values to vue

I can pass a value from a main to my vue instance (another script) but won't work :(

<script>
let data = [{id:'1'}] //JUST SAMPLE

function pass_to_vue(data){
    return data
}
</script> 
 
<script>
var app = new Vue({
el: '#app',
    data: {
        external_value: pass_to_vue // HERE RECEIVE EXTERNAL VALUE
    }
})
</script>

Thanks!

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

0

Please take a look at snippet below:

let ext = [{id:'1'}] 
function pass_to_vue(data){
  return data
}
document.querySelector('#ext').innerText = JSON.stringify(ext)

var app = new Vue({
  el: '#demo',
  data() {
    return {
      external_value: '' 
    }
  },
  mounted() {
    this.external_value = pass_to_vue(ext)
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
  vue value
  {{ external_value }}
  <p>change id</p>
  <input v-model="external_value[0].id" />
  <hr />
</div>
<p>external value</p>
<p id="ext"></p>

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!